Replay the same key-value workload through size-tiered and full-level compaction. On the skewed update trace at fanout 4, size-tiered writes 1.81× the input bytes and searches 2.70 runs per point lookup. Leveling writes 2.24× and searches 1.97 runs.
On the skewed trace at fanout 4, size-tiered writes 1.81× input bytes and searches 2.70 runs per point lookup; full-level writes 2.24× and searches 1.97
knotkit/heap : Provides binary and k-ary min/max heaps plus indexed priority queues, ordered by caller-supplied comparators
knotkit/interval-index : Indexes closed intervals over a caller-supplied order and finds every interval that holds a point or overlaps a range
knotkit/ordered-map : Stores keys in comparator order with insertion, deletion, rank, selection, ceiling, floor, and range scans in either direction, as a B-tree or an indexed skip list
knotkit/prng : Generates seeded pseudorandom numbers and unbiased integers for reproducible simulations and tests
knotkit/scalar-sketch : Provides reducible Bloom filter, HyperLogLog, Count-Min Sketch, and MinHash sketches over four scalar domains
knotkit/sorted-block : Packs byte-keyed entries, given in ascending key order, into one immutable prefix-compressed block with point reads, seeks, and range scans
knotkit/sorted-merge : Lazily merges sorted iterables in comparator order, preserving duplicates and source order on ties
knotkit/static-filter : Builds immutable Binary Fuse membership filters over a known set of byte keys, with no false negatives and fewer bytes than a Bloom filter at the same false-positive rate
{"v":1,"box":[61.4774,94.1597,1043,437.3555],"x":{"s":"linear","lim":[1.27293398533,3.32896679549],"inv":false,"g":0,"t":"Write amplification (bytes written per input byte)","tk":[[1.35781607382,"1.36"],[2,"2"],[2.5,"2.5"],[3.244084707,"3.24"]]},"y":{"s":"linear","lim":[1.84483247423,3.80851804124],"inv":false,"g":0,"tk":[[1.92590206186,"1.93"],[2.5,"2.5"],[3,"3"],[3.72744845361,"3.73"]]},"ti":"Leveled matches or beats 3 of 7 size-tiered fanouts on both axes; size-tiered beats 1","a":[{"k":"line","c":"#fffff8","s":"xy","d":[3.15677498225,2.06894329897,2.15754397034,2.41237113402,1.81177537661,2.69652061856,1.54365486237,3.13079896907,1.47909929805,3.25193298969,1.35781607382,3.64884020619,1.36400741383,3.72744845361],"p":[960.8,398.19,483.78,338.17,318.71,288.5,190.72,212.61,159.9,191.43,102,122.07,104.95,108.33]},{"k":"line","c":"#1d5fa6","s":"xy","d":[3.15677498225,2.06894329897,2.15754397034,2.41237113402,1.81177537661,2.69652061856,1.54365486237,3.13079896907,1.47909929805,3.25193298969,1.35781607382,3.64884020619,1.36400741383,3.72744845361],"p":[960.8,398.19,483.78,338.17,318.71,288.5,190.72,212.61,159.9,191.43,102,122.07,104.95,108.33],"r":4.08},{"k":"line","c":"#fffff8","s":"xy","d":[3.244084707,1.92590206186,2.48801167284,1.92847938144,2.23525120278,1.97422680412,2.00920813944,2.18492268041,1.91365643978,2.39110824742,1.73755816705,2.61469072165,1.82230459815,2.78672680412],"p":[1002.48,423.19,641.54,422.74,520.87,414.74,412.96,377.92,367.35,341.88,283.28,302.81,323.74,272.74]},{"k":"line","c":"#c4501b","s":"xy","d":[3.244084707,1.92590206186,2.48801167284,1.92847938144,2.23525120278,1.97422680412,2.00920813944,2.18492268041,1.91365643978,2.39110824742,1.73755816705,2.61469072165,1.82230459815,2.78672680412],"p":[1002.48,423.19,641.54,422.74,520.87,414.74,412.96,377.92,367.35,341.88,283.28,302.81,323.74,272.74],"r":4.08},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#c4501b"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#c4501b"},{"k":"annotation","c":"#c4501b"},{"k":"annotation","c":"#c4501b"},{"k":"annotation","c":"#c4501b"},{"k":"annotation","c":"#c4501b"},{"k":"annotation","c":"#c4501b"},{"k":"annotation","c":"#5c5c57"}],"lg":[]}
1.36
2
2.5
3.24
Write amplification (bytes written per input byte)
1.93
2.5
3
3.73
size-tiered, fanout 8
leveled, fanout 8
2
3
4
5
6
7
2
3
4
5
6
7
Runs searched per point lookup
Leveled matches or beats 3 of 7 size-tiered fanouts on both axes; size-tiered beats 1
{"v":1,"box":[61.4774,150.6246,595,437.3555],"x":{"s":"linear","lim":[1.27293398533,3.32896679549],"inv":false,"g":0,"t":"Write amplification (bytes written per input byte)","tk":[[1.35781607382,"1.36"],[2,"2"],[2.5,"2.5"],[3.244084707,"3.24"]]},"y":{"s":"linear","lim":[1.84483247423,3.80851804124],"inv":false,"g":0,"tk":[[1.92590206186,"1.93"],[2.5,"2.5"],[3,"3"],[3.72744845361,"3.73"]]},"ti":"Leveled matches or beats 3 of 7\nsize-tiered fanouts on both axes;\nsize-tiered beats 1","a":[{"k":"line","c":"#fffff8","s":"xy","d":[3.15677498225,2.06894329897,2.15754397034,2.41237113402,1.81177537661,2.69652061856,1.54365486237,3.13079896907,1.47909929805,3.25193298969,1.35781607382,3.64884020619,1.36400741383,3.72744845361],"p":[550.32,404.63,291.03,354.49,201.3,312.99,131.73,249.58,114.98,231.9,83.5,173.94,85.11,162.46]},{"k":"line","c":"#1d5fa6","s":"xy","d":[3.15677498225,2.06894329897,2.15754397034,2.41237113402,1.81177537661,2.69652061856,1.54365486237,3.13079896907,1.47909929805,3.25193298969,1.35781607382,3.64884020619,1.36400741383,3.72744845361],"p":[550.32,404.63,291.03,354.49,201.3,312.99,131.73,249.58,114.98,231.9,83.5,173.94,85.11,162.46],"r":4.08},{"k":"line","c":"#fffff8","s":"xy","d":[3.244084707,1.92590206186,2.48801167284,1.92847938144,2.23525120278,1.97422680412,2.00920813944,2.18492268041,1.91365643978,2.39110824742,1.73755816705,2.61469072165,1.82230459815,2.78672680412],"p":[572.97,425.52,376.78,425.14,311.19,418.46,252.53,387.7,227.74,357.59,182.04,324.94,204.03,299.82]},{"k":"line","c":"#c4501b","s":"xy","d":[3.244084707,1.92590206186,2.48801167284,1.92847938144,2.23525120278,1.97422680412,2.00920813944,2.18492268041,1.91365643978,2.39110824742,1.73755816705,2.61469072165,1.82230459815,2.78672680412],"p":[572.97,425.52,376.78,425.14,311.19,418.46,252.53,387.7,227.74,357.59,182.04,324.94,204.03,299.82],"r":4.08},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#c4501b"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#c4501b"},{"k":"annotation","c":"#c4501b"},{"k":"annotation","c":"#c4501b"},{"k":"annotation","c":"#c4501b"},{"k":"annotation","c":"#c4501b"},{"k":"annotation","c":"#c4501b"},{"k":"annotation","c":"#5c5c57"}],"lg":[]}
1.36
2
2.5
3.24
Write amplification (bytes written per input byte)
1.93
2.5
3
3.73
size-tiered, fanout 8
leveled, fanout 8
2
3
4
5
6
7
2
3
4
5
6
7
Runs searched per point lookup
Leveled matches or beats 3 of 7
size-tiered fanouts on both axes;
size-tiered beats 1
{"v":1,"box":[203.6597,140.4708,902.7188,445.4349],"x":{"s":"linear","lim":[0,5160],"inv":false,"g":0,"t":"lookups","tk":[[0,"0"],[1000,"1,000"],[2000,"2,000"],[3000,"3,000"],[4000,"4,000"]]},"y":{"s":"linear","lim":[-0.65,2.65],"inv":false,"g":0,"tk":[[2,"No filter"],[1,"Split-block Bloom"],[0,"Binary Fuse 8"]]},"ti":"Block lookups","a":[{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[3568,2],"p":[687.04,200.54],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#1d5fa6","s":"xy","d":[167,1],"p":[226.28,292.95],"r":6.09},{"k":"annotation","c":"#1d5fa6"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[169,0],"p":[226.56,385.37],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"annotation","c":"#111111"}],"lg":[]}
0
1,000
2,000
3,000
4,000
lookups
No filter
Split-block Bloom
Binary Fuse 8
3568
167
169
Cost of 935 missing-key lookups
Block lookups
{"v":1,"box":[972.941,140.4708,1672,445.4349],"x":{"s":"linear","lim":[0,3302.4],"inv":false,"g":1,"t":"bytes","tk":[[0,"0"],[512,"512"],[1024,"1,024"],[1536,"1,536"],[2048,"2,048"],[2560,"2,560"]]},"y":{"s":"linear","lim":[-0.65,2.65],"inv":false,"g":1,"tk":[[2,""],[1,""],[0,""]]},"ti":"Live filter state","a":[{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#1d5fa6","s":"xy","d":[0,2],"p":[972.94,200.54],"r":6.09},{"k":"annotation","c":"#1d5fa6"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[2176,1],"p":[1433.56,292.95],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[2048,0],"p":[1406.47,385.37],"r":6.09},{"k":"annotation","c":"#2b2b28"}],"lg":[]}
0
512
1,024
1,536
2,048
2,560
bytes
0 B
2176 B
2048 B
Live filter state
{"v":1,"box":[203.6597,140.4708,680,477.7358],"x":{"s":"linear","lim":[0,5160],"inv":false,"g":0,"t":"lookups","tk":[[0,"0"],[1000,"1,000"],[2000,"2,000"],[3000,"3,000"],[4000,"4,000"]]},"y":{"s":"linear","lim":[-0.65,2.65],"inv":false,"g":0,"tk":[[2,"No filter"],[1,"Split-block Bloom"],[0,"Binary Fuse 8"]]},"ti":"Block lookups","a":[{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[3568,2],"p":[533.04,206.9],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#1d5fa6","s":"xy","d":[167,1],"p":[219.08,309.1],"r":6.09},{"k":"annotation","c":"#1d5fa6"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[169,0],"p":[219.26,411.3],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"annotation","c":"#111111"}],"lg":[]}
0
1,000
2,000
3,000
4,000
lookups
No filter
Split-block Bloom
Binary Fuse 8
3568
167
169
Cost of 935 missing-key lookups
Block lookups
{"v":1,"box":[203.6597,645.7699,680,983.0349],"x":{"s":"linear","lim":[0,3302.4],"inv":false,"g":1,"t":"bytes","tk":[[0,"0"],[512,"512"],[1024,"1,024"],[1536,"1,536"],[2048,"2,048"],[2560,"2,560"]]},"y":{"s":"linear","lim":[-0.65,2.65],"inv":false,"g":1,"tk":[[2,"No filter"],[1,"Split-block Bloom"],[0,"Binary Fuse 8"]]},"ti":"Live filter state","a":[{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#1d5fa6","s":"xy","d":[0,2],"p":[203.66,712.2],"r":6.09},{"k":"annotation","c":"#1d5fa6"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[2176,1],"p":[517.53,814.4],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[2048,0],"p":[499.06,916.6],"r":6.09},{"k":"annotation","c":"#2b2b28"}],"lg":[]}
0
512
1,024
1,536
2,048
2,560
bytes
No filter
Split-block Bloom
Binary Fuse 8
0 B
2176 B
2048 B
Live filter state
{"v":1,"box":[162.5191,140.4708,882.1484,394.2349],"x":{"s":"linear","lim":[0,516],"inv":false,"g":0,"t":"KiB","tk":[[0,"0"],[100,"100"],[200,"200"],[300,"300"],[400,"400"]]},"y":{"s":"linear","lim":[-0.65,1.65],"inv":false,"g":0,"tk":[[1,"Full-level"],[0,"Overlap-only"]]},"ti":"Clustered updates","a":[{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[234,1],"p":[488.86,212.19],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#1d5fa6","s":"xy","d":[108,0],"p":[313.14,322.52],"r":6.09},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#111111"}],"lg":[]}
0
100
200
300
400
KiB
Full-level
Overlap-only
234.0 KiB
108.0 KiB
Compaction bytes for 4,096 overwrites
Clustered updates
{"v":1,"box":[952.3707,140.4708,1672,394.2349],"x":{"s":"linear","lim":[0,516],"inv":false,"g":1,"t":"KiB","tk":[[0,"0"],[100,"100"],[200,"200"],[300,"300"],[400,"400"]]},"y":{"s":"linear","lim":[-0.65,1.65],"inv":false,"g":1,"tk":[[1,""],[0,""]]},"ti":"Spread updates","a":[{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#1d5fa6","s":"xy","d":[232.875,1],"p":[1277.15,212.19],"r":6.09},{"k":"annotation","c":"#1d5fa6"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[358.03125,0],"p":[1451.69,322.52],"r":6.09},{"k":"annotation","c":"#2b2b28"}],"lg":[]}
0
100
200
300
400
KiB
232.9 KiB
358.0 KiB
Spread updates
{"v":1,"box":[162.5191,140.4708,680,427.3857],"x":{"s":"linear","lim":[0,516],"inv":false,"g":0,"t":"KiB","tk":[[0,"0"],[100,"100"],[200,"200"],[300,"300"],[400,"400"]]},"y":{"s":"linear","lim":[-0.65,1.65],"inv":false,"g":0,"tk":[[1,"Full-level"],[0,"Overlap-only"]]},"ti":"Clustered updates","a":[{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[234,1],"p":[397.19,221.56],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#1d5fa6","s":"xy","d":[108,0],"p":[270.83,346.3],"r":6.09},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#111111"}],"lg":[]}
0
100
200
300
400
KiB
Full-level
Overlap-only
234.0 KiB
108.0 KiB
Compaction bytes for 4,096 overwrites
Clustered updates
{"v":1,"box":[162.5191,593.72,680,880.6349],"x":{"s":"linear","lim":[0,516],"inv":false,"g":1,"t":"KiB","tk":[[0,"0"],[100,"100"],[200,"200"],[300,"300"],[400,"400"]]},"y":{"s":"linear","lim":[-0.65,1.65],"inv":false,"g":1,"tk":[[1,"Full-level"],[0,"Overlap-only"]]},"ti":"Spread updates","a":[{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#1d5fa6","s":"xy","d":[232.875,1],"p":[396.06,674.8],"r":6.09},{"k":"annotation","c":"#1d5fa6"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[358.03125,0],"p":[521.58,799.55],"r":6.09},{"k":"annotation","c":"#2b2b28"}],"lg":[]}
0
100
200
300
400
KiB
Full-level
Overlap-only
232.9 KiB
358.0 KiB
Spread updates
Skewed updates and deletes, seed 0x5eed. 6208 updates, 1552 point lookups, 388 range scans per policy. Fanout 4 of the 2–8 sweep: Size-tiered wrote 1.81× input bytes, searched 2.70 runs per point lookup and 4.53 per scan, retained 10,393 B. Leveled wrote 2.24× input bytes, searched 1.97 runs per point lookup and 3.06 per scan, retained 7,876 B. SSTable point lookups on the skewed trace, size-tiered compaction, fanout 4. get(1405) misses. 2 runs span the key. Block lookups: No filter 2, Split-block Bloom 0, Binary Fuse 8 0. 617 hits passed 617 run range checks; 935 misses passed 3568. A deleted key counts as a miss. No filter: 617 block lookups for hits, 3568 for misses; 0 B of live filter state. Split-block Bloom: 617 block lookups for hits, 167 for misses; 2176 B of live filter state. Binary Fuse 8: 617 block lookups for hits, 169 for misses; 2048 B of live filter state. Compaction bytes when overwriting the same 4,096 keys once. Each flush holds 64 writes, fanout 4. Clustered batches update consecutive keys. Spread batches interleave 16 key ranges. Counts exclude initial loading and flushes. Full-level: 239,616 B clustered, 238,464 B spread. Overlap-only: 110,592 B clustered, 366,624 B spread. Overlap-only rewrites fewer bytes on clustered updates. Spreading each batch across the key space reverses the result. Hover or focus a chart for exact values. Drawn by demo.ts at build time, from the fixtures the benchmark uses; it reproduces the README figure.
git clone https://github.com/jkomyno/knotkit.git && cd knotkit && bun install
bun run demo:problem:lsm-compaction
problems/lsm-compaction/README.md states the fixture, the seed, and the result table.