Repository navigation
merkle: avoid PageId clones and child computations on the hot seek path - #993
Draft
citizen-stig wants to merge 1 commit into
Draft
citizen-stig wants to merge 1 commit into
citizen-stig wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three fewer
PageIdclones or computations per seek step:continue_seektakes the page ID by value.depth() <= 1instead of buildingparent_page_id()and comparing it withROOT_PAGE_ID.Benchmarks
finishon masterfinishon master + #979 + #987No clear gain on its own at either base. With #991, #992 and #994 on master, the four give −7.1% (77.04 → 71.55 ms). That is 0.6 ms more than #991 and #992 alone sum to, so this PR and #994 may add a little together. That is not verified.
Conflict: this conflicts with #979 in one hunk of
merkle/page_walker.rs. The resolution keeps #979's shape with thedepth() <= 1condition.finish_bench: an isolatedSession::finishbenchmark with the user-namespace access profile of a Sovereign SDK node (benchtop/src/bin/finish_bench.rs@ 3469d5c, not part of this PR). 50k–145kReadThenWriteaccesses 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_concurrency8 on all 16 CPUs of an AMD Ryzen 7 7700 (8 cores). Mean of 8 runs. Master is6ee36d3. 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. Linuxcargo test --workspaceandcargo test -p nomt-core --features borsh,serdepass on this branch.🤖 Generated with Claude Code