Skip to content

Commit 523dbff

Browse files
committed
Add merge-bench results
1 parent e8c8683 commit 523dbff

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

‎docs/results/merge-bench.csv‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
sketch,sources,bytes_per_sketch,encode_us,decode_us,merge_all_ms,merge_per_sketch_us,direct_merge_all_ms
2+
kll,10,2406,2.82,4.37,0.103,10.34,0.061
3+
kll,100,2381,3.39,4.20,0.954,9.54,0.489
4+
kll,1000,2388,3.48,4.26,9.332,9.33,4.699
5+
ddsketch,10,701,4.41,4.28,0.049,4.91,0.011
6+
ddsketch,100,684,4.42,4.18,0.494,4.94,0.080
7+
ddsketch,1000,682,4.36,4.19,4.925,4.93,0.800
8+
hll,10,16720,8.52,8.40,0.395,39.51,0.323
9+
hll,100,16720,8.02,7.53,2.245,22.45,1.488
10+
hll,1000,16720,8.27,8.31,17.876,17.88,10.746
11+
countminsketch,10,8622,163.49,65.01,0.692,69.20,0.105
12+
countminsketch,100,8623,163.17,65.59,7.002,70.02,0.478
13+
countminsketch,1000,8622,166.17,65.44,69.446,69.45,6.737
14+
countminsketch_heap,10,8766,165.86,68.79,0.798,79.81,0.154
15+
countminsketch_heap,100,8767,165.66,69.31,7.999,79.99,0.952
16+
countminsketch_heap,1000,8767,167.85,69.45,80.303,80.30,11.941
17+
countsketch,10,8704,126.66,120.36,1.245,124.50,0.154
18+
countsketch,100,8706,126.73,119.85,12.307,123.07,0.532
19+
countsketch,1000,8706,129.55,121.28,124.293,124.29,6.825

‎docs/results/merge-bench.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Sketch serialization and many-source merge cost
2+
3+
Measured with `asap-merge-bench` (`asap-precompute-rs/src/bin/asap_merge_bench.rs`, release build, rustc 1.99.0) on a 56-core x86 server (2.00 GHz, idle), pinned to one core with `taskset -c 4`, on 2026-10-12. Each source sketch holds 20,000 points: lognormal values for KLL (k=200) and DDSketch (alpha 0.01), distinct ids for HLL (default), and Zipf-like keys over 2^20 for Count-Min (4x2048), Count-Min with heap (4x2048, heap 10) and CountSketch (4x2048). `encode_us` and `decode_us` are per sketch (ASAPv1 `snapshot` / `decode_snapshot`). `merge_all_ms` is the `window_merge` path: decode the first payload, then `merge_snapshot` each of the rest. `direct_merge_all_ms` merges sketches that were already decoded with sketchlib's native `merge` (the timing includes one decode, for the accumulator). Every value is the median of 5 runs. Raw CSV: [`merge-bench.csv`](merge-bench.csv).
4+
5+
| sketch | sources | bytes/sketch | encode µs | decode µs | merge all ms | merge µs/sketch | direct merge all ms |
6+
|---|---:|---:|---:|---:|---:|---:|---:|
7+
| kll | 10 | 2406 | 2.82 | 4.37 | 0.103 | 10.34 | 0.061 |
8+
| kll | 100 | 2381 | 3.39 | 4.20 | 0.954 | 9.54 | 0.489 |
9+
| kll | 1000 | 2388 | 3.48 | 4.26 | 9.332 | 9.33 | 4.699 |
10+
| ddsketch | 10 | 701 | 4.41 | 4.28 | 0.049 | 4.91 | 0.011 |
11+
| ddsketch | 100 | 684 | 4.42 | 4.18 | 0.494 | 4.94 | 0.080 |
12+
| ddsketch | 1000 | 682 | 4.36 | 4.19 | 4.925 | 4.93 | 0.800 |
13+
| hll | 10 | 16720 | 8.52 | 8.40 | 0.395 | 39.51 | 0.323 |
14+
| hll | 100 | 16720 | 8.02 | 7.53 | 2.245 | 22.45 | 1.488 |
15+
| hll | 1000 | 16720 | 8.27 | 8.31 | 17.876 | 17.88 | 10.746 |
16+
| countminsketch | 10 | 8622 | 163.49 | 65.01 | 0.692 | 69.20 | 0.105 |
17+
| countminsketch | 100 | 8623 | 163.17 | 65.59 | 7.002 | 70.02 | 0.478 |
18+
| countminsketch | 1000 | 8622 | 166.17 | 65.44 | 69.446 | 69.45 | 6.737 |
19+
| countminsketch_heap | 10 | 8766 | 165.86 | 68.79 | 0.798 | 79.81 | 0.154 |
20+
| countminsketch_heap | 100 | 8767 | 165.66 | 69.31 | 7.999 | 79.99 | 0.952 |
21+
| countminsketch_heap | 1000 | 8767 | 167.85 | 69.45 | 80.303 | 80.30 | 11.941 |
22+
| countsketch | 10 | 8704 | 126.66 | 120.36 | 1.245 | 124.50 | 0.154 |
23+
| countsketch | 100 | 8706 | 126.73 | 119.85 | 12.307 | 123.07 | 0.532 |
24+
| countsketch | 1000 | 8706 | 129.55 | 121.28 | 124.293 | 124.29 | 6.825 |
25+
26+
Findings. On one core, merging 1,000 source sketches for one series and window through the `window_merge` path takes 9.3 ms for KLL, 4.9 ms for DDSketch and 17.9 ms for HLL, but 69 ms for Count-Min, 80 ms for Count-Min with heap and 124 ms for CountSketch. The cost per source is flat from 100 to 1,000 sources, so it grows linearly with the source count. Decoding the ASAPv1 payloads accounts for roughly 46% of the merge time for KLL and HLL (1,000 × 4.3 µs of 9.3 ms; 1,000 × 8.3 µs of 17.9 ms), 85% for DDSketch, and 86–98% for the three 4x2048 counter sketches: merging already-decoded Count-Min sketches takes 6.7 ms, against 69 ms from bytes. Encoding a 4x2048 counter sketch (127–168 µs) is also 15–50x slower than encoding KLL, DDSketch or HLL. These numbers cover single-threaded encode, decode and merge only, not network transfer or the rest of the pipeline.

0 commit comments

Comments
 (0)