x 8d220f215b feat: Add persistent tree caches to database overlays 3 weeks ago
..
README.md d719f1a20b perf: Index retained managed tree overlay history 3 weeks ago
database_history.rs 8d220f215b feat: Add persistent tree caches to database overlays 3 weeks ago
tree_history.rs b352fb90cb chore: Clippy lints 3 weeks ago
value_reads.rs 8d220f215b feat: Add persistent tree caches to database overlays 3 weeks ago

README.md

Benchmarks

Database history

database_history measures capture and front-only confirmation separately from caller persistence on Fjall and Sled:

cargo bench --bench database_history
cargo bench --no-default-features --features sled-backend --bench database_history
cargo bench --features bench-allocations --bench database_history
cargo bench --no-default-features --features sled-backend,bench-allocations --bench database_history

Output is CSV. Default workloads use 1, 31, and 255 retained steps, with 15 timed samples after three warmups. Every sample builds its own overlay, captures one new step, then persists/confirms the entire queue. Reported confirmation points are the front, midpoint, and last step. Setup, edits, and persistence are outside operation timers; required rebinding and payload destruction are part of confirmation. Timing builds do not enable the allocation counter. Median and p95 are descriptive local measurements, including timer overhead and backend/background variability.

Case Work per step
repeated One key, 32-byte values
wide 32 keys in one tree, 32-byte values
multitree Four keys in each of eight trees, 32-byte values
large_values Four keys, 4-KiB values
unrelated_keys Retain the first key while repeatedly changing a different key
unrelated_trees Retain the first tree while rotating updates through seven others
empty_steps One insertion, unchanged captures, then one update
empty_lifetimes Alternating empty-tree creation/drop

Override the case, comma-separated history lengths, or timed sample count:

HISTORY_CASE=unrelated_trees HISTORY_LENGTHS=31,255 HISTORY_SAMPLES=30 cargo bench --bench database_history

Allocation mode reports foreground allocation count, allocated bytes, and net bytes for each operation. Net operation bytes can be negative, including backend memory released during confirmation. retained_bytes is measured independently: rebuild the same snapshot, pin its backend handles outside the measurement, then count bytes freed by dropping the sole overlay. This includes data, retained diff payloads, bookkeeping, handle-local allocations, and retained container capacity; it excludes shared backend storage, stack memory, allocator overhead, and RSS. No overlay clone keeps diff payloads alive. Prepared rows report only this retained-memory snapshot. Persistence allocations are not charged to capture or confirmation.

For before/after comparison, use the same harness and settings on both revisions. The pre-index database baseline is 6f235ca, with this benchmark and its Cargo target/feature configuration copied in. Results and implementation findings are recorded in overlay-bookkeeping-implementation.md.

Standalone tree history

tree_history measures ManagedTreeOverlay capture and confirmation with the same CSV format, 1/31/255 retained steps, 15 samples after three warmups, and separate allocation/retention mode described above:

cargo bench --bench tree_history
cargo bench --no-default-features --features sled-backend --bench tree_history
cargo bench --features bench-allocations --bench tree_history
cargo bench --no-default-features --features sled-backend,bench-allocations --bench tree_history

Each sample starts with an empty real tree and an independent overlay, captures one additional step, and persists/confirms the full queue. Setup, edits, backend clearing, and caller persistence are excluded from operation timers. Retained memory is measured by independently rebuilding each snapshot and dropping the sole overlay while holding its backend tree outside the measurement.

Case Work per step
repeated One key, 32-byte values
wide 32 keys, 32-byte values
large_values Four keys, 4-KiB values
unrelated_keys Retain the first key while repeatedly changing a different key
distinct_keys Insert one new key per step, growing the candidate/index key set
empty_steps One insertion, unchanged captures, then one update
remove_reinsert Alternate insertion/removal of one key with 32-byte values
empty_values Alternate insertion/removal of one key with empty values

The same HISTORY_CASE, HISTORY_LENGTHS, and HISTORY_SAMPLES overrides apply. For example:

HISTORY_CASE=distinct_keys HISTORY_LENGTHS=31,255 HISTORY_SAMPLES=30 cargo bench --bench tree_history

The pre-index standalone baseline is 5dc3718, with this benchmark and its Cargo target configuration copied in. Use the identical harness and settings for both revisions. Before/after measurements and tradeoffs are recorded in overlay-bookkeeping-implementation.md.