[autoopt] 20260414-012-trie-exact-node-lookups - #23510
Closed
mediocregopher wants to merge 1 commit into
Closed
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-019d8d0c-1120-707a-9e9d-4a78cf69a683 Co-authored-by: Amp <amp@ampcode.com>
Member
Author
|
derek bench |
Contributor
|
Your PR title doesn't follow the Conventional Commit guidelines. Example of valid titles:
Usage:
Breaking Changes Breaking changes are noted by using an exclamation mark. For example:
Help For more information, follow the guidelines here: https://www.conventionalcommits.org/en/v1.0.0/ |
Member
|
✅ Benchmark complete! View job Benchmark Results
200 blocks, 100 warmup Wait Time BreakdownPersistence Wait
Trie Cache Update Wait
Execution Cache Update Wait
ChartsGrafana Dashboard |
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.



Avoid rebuilding exact trie lookup pairs in changeset reads
Evidence
trie-inputworker at 68,365 samples, withcompute_trie_changesetsat 67,228 inclusive samples,InMemoryTrieCursor::seek_exactat 64,955, andcursor_seekat 52,418.node_key(21,595 samples),BranchNodeCompactdecompression (2,691), andPackedStorageTrieEntry::from_compact(1,489), which is consistent with exact lookups doing extra key materialization around each hit.crates/trie/trie/src/changesets.rsonly needs the old node value, butseek_exact()returned a full(path, node)pair, forcing exact-hit cursor paths to rebuild keys that are immediately discarded.Hypothesis
If we add an exact-hit cursor API that returns only the node and use it in trie changeset computation, gas throughput improves by ~0.2-0.5% because exact trie lookups avoid rebuilding keys that the changeset path never consumes.
Success Metric
Plan
seek_exact_node()and override it in the in-memory and database cursor implementations.cargo check -p reth-trie -p reth-trie-db,cargo test -p reth-trie changesets --lib, and targeted trie-db cursor tests.