Skip to content

Instantly share code, notes, and snippets.

@cykl
Created June 2, 2013 18:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cykl/5694413 to your computer and use it in GitHub Desktop.
Save cykl/5694413 to your computer and use it in GitHub Desktop.
Benchmarks for stream-lib/faster_hll
# Measurement Section
# Runtime (per iteration): 5s
# Iterations: 10
# Thread counts (concurrent threads per iteration): [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
# Threads will synchronize iterations
# Running: bench.generated.avgtime.HLLMergeBenchmark.hllMerge
# Warmup Iteration 1 (3s in 1 thread): 0.377 msec/op
# Warmup Iteration 2 (3s in 1 thread): 0.314 msec/op
# Warmup Iteration 3 (3s in 1 thread): 0.311 msec/op
# Warmup Iteration 4 (3s in 1 thread): 0.311 msec/op
# Warmup Iteration 5 (3s in 1 thread): 0.310 msec/op
Iteration 1 (5s in 1 thread): 0.310 msec/op
Iteration 2 (5s in 1 thread): 0.311 msec/op
Iteration 3 (5s in 1 thread): 0.311 msec/op
Iteration 4 (5s in 1 thread): 0.311 msec/op
Iteration 5 (5s in 1 thread): 0.311 msec/op
Iteration 6 (5s in 1 thread): 0.313 msec/op
Iteration 7 (5s in 1 thread): 0.315 msec/op
Iteration 8 (5s in 1 thread): 0.315 msec/op
Iteration 9 (5s in 1 thread): 0.314 msec/op
Iteration 10 (5s in 1 thread): 0.317 msec/op
Run result "hllMerge": 0.313 ±(95%) 0.002 ±(99%) 0.002 msec/op
Run statistics "hllMerge": min = 0.310, avg = 0.313, max = 0.317, stdev = 0.002
Run confidence intervals "hllMerge": 95% [0.311, 0.314], 99% [0.310, 0.315]
# Runtime (per iteration): 5s
# Iterations: 10
# Thread counts (concurrent threads per iteration): [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
# Threads will synchronize iterations
# Running: bench.generated.avgtime.HLLMergeBenchmark.hllMergeOrig
# Warmup Iteration 1 (3s in 1 thread): 2.985 msec/op
# Warmup Iteration 2 (3s in 1 thread): 3.360 msec/op
# Warmup Iteration 3 (3s in 1 thread): 2.969 msec/op
# Warmup Iteration 4 (3s in 1 thread): 2.972 msec/op
# Warmup Iteration 5 (3s in 1 thread): 2.969 msec/op
Iteration 1 (5s in 1 thread): 2.965 msec/op
Iteration 2 (5s in 1 thread): 2.966 msec/op
Iteration 3 (5s in 1 thread): 2.969 msec/op
Iteration 4 (5s in 1 thread): 2.956 msec/op
Iteration 5 (5s in 1 thread): 2.957 msec/op
Iteration 6 (5s in 1 thread): 2.962 msec/op
Iteration 7 (5s in 1 thread): 2.963 msec/op
Iteration 8 (5s in 1 thread): 2.961 msec/op
Iteration 9 (5s in 1 thread): 2.959 msec/op
Iteration 10 (5s in 1 thread): 2.960 msec/op
Run result "hllMergeOrig": 2.962 ±(95%) 0.003 ±(99%) 0.004 msec/op
Run statistics "hllMergeOrig": min = 2.956, avg = 2.962, max = 2.969, stdev = 0.004
Run confidence intervals "hllMergeOrig": 95% [2.959, 2.965], 99% [2.958, 2.966]
# Runtime (per iteration): 5s
# Iterations: 10
# Thread counts (concurrent threads per iteration): [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
# Threads will synchronize iterations
# Running: bench.generated.avgtime.HLLMergeBenchmark.hllPlusMerge
# Warmup Iteration 1 (3s in 1 thread): 0.314 msec/op
# Warmup Iteration 2 (3s in 1 thread): 0.314 msec/op
# Warmup Iteration 3 (3s in 1 thread): 0.299 msec/op
# Warmup Iteration 4 (3s in 1 thread): 0.310 msec/op
# Warmup Iteration 5 (3s in 1 thread): 0.313 msec/op
Iteration 1 (5s in 1 thread): 0.313 msec/op
Iteration 2 (5s in 1 thread): 0.313 msec/op
Iteration 3 (5s in 1 thread): 0.313 msec/op
Iteration 4 (5s in 1 thread): 0.313 msec/op
Iteration 5 (5s in 1 thread): 0.314 msec/op
Iteration 6 (5s in 1 thread): 0.313 msec/op
Iteration 7 (5s in 1 thread): 0.313 msec/op
Iteration 8 (5s in 1 thread): 0.313 msec/op
Iteration 9 (5s in 1 thread): 0.313 msec/op
Iteration 10 (5s in 1 thread): 0.313 msec/op
Run result "hllPlusMerge": 0.313 ±(95%) 0.000 ±(99%) 0.000 msec/op
Run statistics "hllPlusMerge": min = 0.313, avg = 0.313, max = 0.314, stdev = 0.000
Run confidence intervals "hllPlusMerge": 95% [0.313, 0.313], 99% [0.313, 0.314]
# Runtime (per iteration): 5s
# Iterations: 10
# Thread counts (concurrent threads per iteration): [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
# Threads will synchronize iterations
# Running: bench.generated.avgtime.HLLMergeBenchmark.hllPlusMergeOrig
# Warmup Iteration 1 (3s in 1 thread): 3.116 msec/op
# Warmup Iteration 2 (3s in 1 thread): 3.093 msec/op
# Warmup Iteration 3 (3s in 1 thread): 3.099 msec/op
# Warmup Iteration 4 (3s in 1 thread): 3.102 msec/op
# Warmup Iteration 5 (3s in 1 thread): 3.097 msec/op
Iteration 1 (5s in 1 thread): 3.097 msec/op
Iteration 2 (5s in 1 thread): 3.101 msec/op
Iteration 3 (5s in 1 thread): 3.099 msec/op
Iteration 4 (5s in 1 thread): 3.102 msec/op
Iteration 5 (5s in 1 thread): 3.097 msec/op
Iteration 6 (5s in 1 thread): 3.096 msec/op
Iteration 7 (5s in 1 thread): 3.097 msec/op
Iteration 8 (5s in 1 thread): 3.093 msec/op
Iteration 9 (5s in 1 thread): 3.094 msec/op
Iteration 10 (5s in 1 thread): 3.095 msec/op
Run result "hllPlusMergeOrig": 3.097 ±(95%) 0.002 ±(99%) 0.003 msec/op
Run statistics "hllPlusMergeOrig": min = 3.093, avg = 3.097, max = 3.102, stdev = 0.003
Run confidence intervals "hllPlusMergeOrig": 95% [3.095, 3.099], 99% [3.094, 3.100]
# Runtime (per iteration): 5s
# Iterations: 10
# Thread counts (concurrent threads per iteration): [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
# Threads will synchronize iterations
# Running: bench.generated.throughput.HLLOfferBenchmark.hllOfferInt
# Warmup Iteration 1 (3s in 1 thread): 86647.912 ops/msec
# Warmup Iteration 2 (3s in 1 thread): 87273.245 ops/msec
# Warmup Iteration 3 (3s in 1 thread): 87920.980 ops/msec
# Warmup Iteration 4 (3s in 1 thread): 87942.991 ops/msec
# Warmup Iteration 5 (3s in 1 thread): 87842.123 ops/msec
Iteration 1 (5s in 1 thread): 87850.120 ops/msec
Iteration 2 (5s in 1 thread): 87852.193 ops/msec
Iteration 3 (5s in 1 thread): 87952.788 ops/msec
Iteration 4 (5s in 1 thread): 88003.762 ops/msec
Iteration 5 (5s in 1 thread): 87756.028 ops/msec
Iteration 6 (5s in 1 thread): 87887.437 ops/msec
Iteration 7 (5s in 1 thread): 88007.154 ops/msec
Iteration 8 (5s in 1 thread): 87904.741 ops/msec
Iteration 9 (5s in 1 thread): 87864.571 ops/msec
Iteration 10 (5s in 1 thread): 87792.039 ops/msec
Run result "hllOfferInt": 87887.083 ±(95%) 59.350 ±(99%) 85.274 ops/msec
Run statistics "hllOfferInt": min = 87756.028, avg = 87887.083, max = 88007.154, stdev = 82.972
Run confidence intervals "hllOfferInt": 95% [87827.733, 87946.434], 99% [87801.810, 87972.357]
# Runtime (per iteration): 5s
# Iterations: 10
# Thread counts (concurrent threads per iteration): [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
# Threads will synchronize iterations
# Running: bench.generated.throughput.HLLOfferBenchmark.hllOfferIntOrig
# Warmup Iteration 1 (3s in 1 thread): 62783.065 ops/msec
# Warmup Iteration 2 (3s in 1 thread): 66192.891 ops/msec
# Warmup Iteration 3 (3s in 1 thread): 65902.016 ops/msec
# Warmup Iteration 4 (3s in 1 thread): 65932.382 ops/msec
# Warmup Iteration 5 (3s in 1 thread): 66018.394 ops/msec
Iteration 1 (5s in 1 thread): 65936.995 ops/msec
Iteration 2 (5s in 1 thread): 65925.273 ops/msec
Iteration 3 (5s in 1 thread): 65999.392 ops/msec
Iteration 4 (5s in 1 thread): 66056.409 ops/msec
Iteration 5 (5s in 1 thread): 66111.274 ops/msec
Iteration 6 (5s in 1 thread): 66028.462 ops/msec
Iteration 7 (5s in 1 thread): 65982.001 ops/msec
Iteration 8 (5s in 1 thread): 66051.908 ops/msec
Iteration 9 (5s in 1 thread): 66003.780 ops/msec
Iteration 10 (5s in 1 thread): 65990.976 ops/msec
Run result "hllOfferIntOrig": 66008.647 ±(95%) 40.107 ±(99%) 57.625 ops/msec
Run statistics "hllOfferIntOrig": min = 65925.273, avg = 66008.647, max = 66111.274, stdev = 56.070
Run confidence intervals "hllOfferIntOrig": 95% [65968.540, 66048.754], 99% [65951.021, 66066.272]
Benchmark Thr Cnt Sec Mean Mean error Var Units
b.g.avgtime.HLLMergeBenchmark.hllMerge 1 10 5 0.313 0.002 0.000 msec/op
b.g.avgtime.HLLMergeBenchmark.hllMergeOrig 1 10 5 2.962 0.004 0.000 msec/op
b.g.avgtime.HLLMergeBenchmark.hllPlusMerge 1 10 5 0.313 0.000 0.000 msec/op
b.g.avgtime.HLLMergeBenchmark.hllPlusMergeOrig 1 10 5 3.097 0.003 0.000 msec/op
b.g.throughput.HLLOfferBenchmark.hllOfferInt 1 10 5 87887.083 85.274 6884.359 ops/msec
b.g.throughput.HLLOfferBenchmark.hllOfferIntOrig 1 10 5 66008.647 57.625 3143.832 ops/msec
package bench;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.BenchmarkType;
import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.State;
import com.clearspring.analytics.stream.cardinality.CardinalityMergeException;
import com.clearspring.analytics.stream.cardinality.HyperLogLog;
import com.clearspring.analytics.stream.cardinality.HyperLogLogPlus;
import com.clearspring.analytics.stream.cardinality.ICardinality;
@State
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class HLLMergeBenchmark {
final int numToMerge = 5;
final int bits = 16;
final int cardinality = 100000;
HyperLogLog[] hlls = new HyperLogLog[numToMerge];
HyperLogLogOrig[] hllsOrig = new HyperLogLogOrig[numToMerge];
HyperLogLogPlus[] hllps = new HyperLogLogPlus[numToMerge];
HyperLogLogPlusOrig[] hllpsOrig = new HyperLogLogPlusOrig[numToMerge];
public HLLMergeBenchmark() {
for (int i = 0; i < numToMerge; i++) {
hlls[i] = new HyperLogLog(bits);
hllsOrig[i] = new HyperLogLogOrig(bits);
hllps[i] = new HyperLogLogPlus(bits);
hllpsOrig[i] = new HyperLogLogPlusOrig(bits);
for (int j = 0; j < cardinality; j++) {
double val = Math.random();
hlls[i].offer(val);
hllsOrig[i].offer(val);
hllps[i].offer(val);
hllpsOrig[i].offer(val);
}
}
}
@GenerateMicroBenchmark(BenchmarkType.AverageTimePerOp)
public ICardinality hllMerge() throws CardinalityMergeException {
HyperLogLog hll = hlls[0];
HyperLogLog[] tmp = Arrays.copyOfRange(hlls, 1, hlls.length);
return hll.merge(tmp);
}
@GenerateMicroBenchmark(BenchmarkType.AverageTimePerOp)
public ICardinality hllMergeOrig() throws CardinalityMergeException {
HyperLogLogOrig hll = hllsOrig[0];
HyperLogLogOrig[] tmp = Arrays
.copyOfRange(hllsOrig, 1, hllsOrig.length);
return hll.merge(tmp);
}
@GenerateMicroBenchmark(BenchmarkType.AverageTimePerOp)
public ICardinality hllPlusMerge() throws CardinalityMergeException {
HyperLogLogPlus hll = hllps[0];
HyperLogLogPlus[] tmp = Arrays.copyOfRange(hllps, 1, hllps.length);
return hll.merge(tmp);
}
@GenerateMicroBenchmark(BenchmarkType.AverageTimePerOp)
public ICardinality hllPlusMergeOrig() throws CardinalityMergeException {
HyperLogLogPlusOrig hll = hllpsOrig[0];
HyperLogLogPlusOrig[] tmp = Arrays.copyOfRange(hllpsOrig, 1, hllpsOrig.length);
return hll.merge(tmp);
}
}
package bench;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.BenchmarkType;
import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.State;
import com.clearspring.analytics.stream.cardinality.HyperLogLog;
@State
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class HLLOfferBenchmark {
final Random rand = new Random(42);
final int bits = 16;
HyperLogLog hll = new HyperLogLog(bits);
HyperLogLogOrig hllOrig = new HyperLogLogOrig(bits);
@GenerateMicroBenchmark(BenchmarkType.OpsPerTimeUnit)
public void hllOfferInt() {
hll.offerHashed(rand.nextInt());
}
@GenerateMicroBenchmark(BenchmarkType.OpsPerTimeUnit)
public void hllOfferIntOrig() {
hllOrig.offerHashed(rand.nextInt());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment