Skip to content

beatree: reconstruct branch separator keys as four shifted words - #994

Draft
citizen-stig wants to merge 1 commit into
thrumdev:masterfrom
citizen-stig:nikolai/word-reconstruct-key
Draft

citizen-stig wants to merge 1 commit into
thrumdev:masterfrom
citizen-stig:nikolai/word-reconstruct-key

Conversation

@citizen-stig

@citizen-stig citizen-stig commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What

bit_ops::reconstruct_key builds the key as four u64 words. It shifts the separator past the prefix and ORs in the masked prefix, instead of bitwise_memcpy plus byte-wise masking. A new test compares it with the reference implementation for every prefix length (0–256), separator bit offset (0–7) and separator length.

Benchmarks

base this PR Δ
finish on master 77.04 ± 0.67 ms 76.80 ± 0.60 ms −0.3%
finish on master + #979 + #987 66.12 ± 0.23 ms 65.97 ± 0.44 ms −0.2%

No measurable gain at either base. With #991, #992 and #993 on master, the four give −7.1%.

finish_bench: an isolated Session::finish benchmark with the user-namespace access profile of a Sovereign SDK node (benchtop/src/bin/finish_bench.rs @ 3469d5c, not part of this PR). 50k–145k ReadThenWrite accesses per slot (68% updates with the prior value, 32% inserts), 36-byte values, BinaryHasher<Sha256>, rollback on, tree growing from 5.35M leaves, 10 warm-up + 20 measured slots from a restored seed DB. commit_concurrency 8 on all 16 CPUs of an AMD Ryzen 7 7700 (8 cores). Mean of 8 runs. Master is 6ee36d3. This PR, the three other small-commit PRs, and the same four on master + #979 + #987 were measured in one batch, with order rotated each round. Every run ends at the same root. Linux cargo test --workspace and cargo test -p nomt-core --features borsh,serde pass on this branch.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants