Topic 3 — notes
Predictions (fill BEFORE running)
| Bench | my btree | redb |
|---|---|---|
| point lookup 1M, warm (ns/op) | ||
| range scan 1K rows (µs) | ||
| long-key (32B, shared prefix) height / lookup | — | |
| after suffix truncation: height / fanout / lookup | — |
Fanout arithmetic check (before measuring): 4KB page, 8B key + 2B ptr + 4B lens ⇒ leaf holds ~N cells; interior fanout ~M ⇒ predicted height at 1e6 keys = ___.
Reading answers
turso deep (reading-turso-btree-deep.md)
- Table vs index interior cell contents / fanout:
- Why defrag is needed despite freeblocks:
- Yield-point invariant in async balance:
SQLite btree.c (reading-sqlite-btree.md)
- fillInCell overflow-first ordering safety:
- balance_quick savings for fillseq:
- Trust-vs-verify position:
LMDB (reading-lmdb.md)
- Why no sibling redistribution on split:
- Which fsync could go, on what hardware:
- 1-key commit cost LMDB vs WAL engine; where LMDB still wins:
Graefe survey
- Suffix (interior) vs prefix (leaf) truncation asymmetry:
- Is SQLite right to skip both?
- The one-sentence dense-filter principle:
File format doc
- Annotated hex dump (paste here):
Experiment findings
- Warm-cache caveat: at 1M keys everything fits in the OS page cache — this benches CPU + page format, not IO. (Buffer pool + cold runs = topic 6.)
- redb comparison, explained in fanout/height terms:
- Truncation result — fanout before/after, height change, lookup delta:
M3 log
- Page format designed before peeking; diffs vs reference cow_btree noted:
- Disk vs Arc-COW writeup (free-space mgmt, splits, checksums vs refcounts):
- Range-index smoke bench in workload generator: