What's Changed
Eliminates runtime.memmove (16% CPU) from the write path by replacing sorted buffer insertion with unsorted append and lazy sorting.
appendToBufferswitched from sorted insertion (O(B) memmove per insert) to O(1) unsorted append- Removed eager sorting from
flushNode— sorting now only happens at leaf merge time viaresolveMessages - Added linear-scan fallback in
bufferMessagesForKeyandbufferSlicefor reads on unsorted buffers (safe under RLock) - Batch leaf merge and iterator refactor
- Cross-impl benchmarks now match Google BTree node config (
WithBlockSize(63))
Benchmarks (vs v0.3.0)
| Benchmark | Delta | Meaning |
|---|---|---|
| Put (all sizes) | ~ | No change |
| Get/Hit | +9.5% | Slower (linear scan on unsorted buffer) |
| Get/Miss | +5.6% | Slower |
| Delete | +11.1% | Slower |
| Range/10 | -99.7% | Faster |
| Range/10000 | -74.7% | Faster |
| Upsert | -15.8% | Faster |
Read regressions are expected and acceptable — this is a write-optimized B^ε-tree. The write path no longer pays any sorting or memmove cost on insert. Full
comparison in benchmarks/benchstat_v0.3.0...v0.4.0.txt.
Docs
- ADR-004: design rationale, alternatives rejected, invariants