public double doTrial()

in src/main/java/org/apache/datasketches/characterization/hll/HllUnionUpdateSpeedProfile.java [46:78]


  public double doTrial(final int uPerTrial) {
    if (direct) {
      final int bytes = HllSketch.getMaxUpdatableSerializationBytes(lgK, tgtHllType);
      for (int i = 0; i < numSketches; i++) {
        final WritableMemory wmem = WritableMemory.allocate(bytes);
        sketches[i] = new HllSketch(lgK, tgtHllType, wmem);
      }
    } else {
      for (int i = 0; i < numSketches; i++) {
        sketches[i] = new HllSketch(lgK, tgtHllType);
      }
    }

    { // spray values across all sketches
      // if uPerTrial < numSketches, some sketches will be empty.
      // if (uPerTrial % numSketches != 0) some sketches will have one less update.
      int i = 0;
      for (int u = uPerTrial; u-- > 0;) {
        sketches[i++].update(++vIn);
        if (i == numSketches) { i = 0; }
      }
    }

    final Union union = new Union(lgK);
    final long startUpdateTime_nS = System.nanoTime();

    for (int i = numSketches; i-- > 0;) {
      union.update(sketches[i]);
    }

    final long updateTime_nS = System.nanoTime() - startUpdateTime_nS;
    return updateTime_nS;
  }