Skip to content

perf: cache repeated storage trie lookups - #683

Open
Qumeric wants to merge 1 commit into
develop-v2.1.0from
valery/storage-trie-lookup-cache
Open

perf: cache repeated storage trie lookups#683
Qumeric wants to merge 1 commit into
develop-v2.1.0from
valery/storage-trie-lookup-cache

Conversation

@Qumeric

@Qumeric Qumeric commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Add one-entry caches for address hashes and storage-trie references in WitnessDb. REVM storage accesses commonly arrive in runs for the same account, so this avoids repeated address Keccak operations and storage-trie hash-table lookups without adding a general-purpose cache.

WitnessDb borrows the backing Ethereum state immutably, so cached trie references cannot become stale during execution.

Benchmark results

Block 24001988, execute-metered, develop-v2.1.0 vs this PR:

metric develop-v2.1.0 this PR delta
execute_metered_insns 588,618,511 585,948,254 −2,670,257 (−0.454%)
metered_rows_unpadded 844,070,559 838,480,858 −5,589,701 (−0.662%)
metered_main_cells_unpadded 43,260,383,096 42,788,778,698 −471,604,398 (−1.090%)
metered_interaction_cells_unpadded 13,194,454,796 13,132,564,727 −61,890,069 (−0.469%)
metered_memory_unpadded_bytes 713,961,114,662 711,203,678,744 −2,757,435,918 (−0.386%)
app segments 65 64 −1

Cells fall about twice as far as instructions, and the block crosses a segment boundary, because the work being skipped is trie resolution — memory traffic rather than arithmetic.

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.

1 participant