in src/main/java/org/apache/datasketches/characterization/quantiles/ItemsSketchSpeedProfile.java [80:125]
public void doTrial() {
shuffle(randInput);
final long startBuild = System.nanoTime();
final ItemsSketch<Double> sketch = ItemsSketch.getInstance(Double.class, k, COMPARATOR);
final long stopBuild = System.nanoTime();
buildTimeNs += stopBuild - startBuild;
final long startUpdate = System.nanoTime();
for (int i = 0; i < randInput.length; i++) {
sketch.update(randInput[i]);
}
final long stopUpdate = System.nanoTime();
updateTimeNs += stopUpdate - startUpdate;
final long startGetQuantiles = System.nanoTime();
sketch.getQuantiles(orderedLittleDoubles);
final long stopGetQuantiles = System.nanoTime();
getQuantilesTimeNs += stopGetQuantiles - startGetQuantiles;
final long startGetCdf = System.nanoTime();
sketch.getCDF(orderedBigDoubles);
final long stopGetCdf = System.nanoTime();
getCdfTimeNs += stopGetCdf - startGetCdf;
final long startGetRanks = System.nanoTime();
final double[] estRanks = sketch.getRanks(orderedBigDoubles);
final long stopGetRank = System.nanoTime();
getRankTimeNs += stopGetRank - startGetRanks;
final long startSerialize = System.nanoTime();
final byte[] bytes = sketch.toByteArray(SERDE);
final long stopSerialize = System.nanoTime();
serializeTimeNs += stopSerialize - startSerialize;
final WritableMemory mem = WritableMemory.writableWrap(bytes);
final long startDeserialize = System.nanoTime();
ItemsSketch.getInstance(Double.class, mem, COMPARATOR, SERDE);
final long stopDeserialize = System.nanoTime();
deserializeTimeNs += stopDeserialize - startDeserialize;
// could record the last one since they must be the same
// but let's average across all trials to see if there is an anomaly
numRetainedItems += sketch.getNumRetained();
serializedSizeBytes += bytes.length;
}