in src/main/java/org/apache/datasketches/characterization/hll/HllMergeSpeedProfile.java [77:136]
public void doTrial(final Stats stats, final int lgK, final int lgDeltaU) {
//final int U = 1 << (lgK + lgDeltaU);
long start;
long serTime_nS = 0;
long deserTime_nS = 0;
long mergeTime_nS = 0;
//final HllSketch source = newSketch(lgK);
//final long vStartUnion = vIn;
//final long vStart = vIn;
//for (int u = 0; u < U; u++) { source.update(++vIn); }
//final long trueU = vIn - vStart;
//checkEstimate(trueU, source.getEstimate(), lgK, "Source");
HllSketch source2 = null;
final byte[] byteArr;
if (serDe) {
//Serialize
if (compact) {
start = System.nanoTime();
byteArr = source.toCompactByteArray();
serTime_nS += System.nanoTime() - start;
} else {
start = System.nanoTime();
byteArr = source.toUpdatableByteArray();
serTime_nS += System.nanoTime() - start;
}
//Deserialize
if (wrap) {
start = System.nanoTime();
final Memory mem = Memory.wrap(byteArr);
source2 = HllSketch.wrap(mem);
deserTime_nS += System.nanoTime() - start;
} else { //heapify
start = System.nanoTime();
final Memory mem = Memory.wrap(byteArr);
source2 = HllSketch.heapify(mem);
deserTime_nS += System.nanoTime() - start;
}
//checkEstimate(trueU, source2.getEstimate(), lgK, "SerDe");
//Merge
start = System.nanoTime();
union.update(source2);
mergeTime_nS += System.nanoTime() - start;
} else {
//Merge
start = System.nanoTime();
union.update(source);
mergeTime_nS += System.nanoTime() - start;
}
stats.serializeTime_nS = serTime_nS;
stats.deserializeTime_nS = deserTime_nS;
stats.mergeTime_nS = mergeTime_nS;
stats.totalTime_nS = mergeTime_nS;
//final double vUnionActual = vIn - vStartUnion;
//checkEstimate(vUnionActual, union.getEstimate(), lgK, "Union");
}