Skip to content

perf: cache repeated storage trie lookups - #665

Closed
Qumeric wants to merge 1 commit into
codex/mpt-witness-rlp-formsfrom
codex/storage-trie-lookup-cache
Closed

perf: cache repeated storage trie lookups#665
Qumeric wants to merge 1 commit into
codex/mpt-witness-rlp-formsfrom
codex/storage-trie-lookup-cache

Conversation

@Qumeric

@Qumeric Qumeric commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Stacked on #664.

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, RVR execution. The attribution points 29811230163 and 29750974205 differ only by this cache change:

metric before cache with cache delta
execute_metered_insns 644,105,893 640,063,687 −4,042,206 (−0.63%)
metered_rows_unpadded 927,502,024 923,404,883 −4,097,141 (−0.44%)
metered_main_cells_unpadded 47,413,076,953 46,872,486,323 −540,590,630 (−1.14%)
metered_interaction_cells_unpadded 14,470,853,876 14,381,062,111 −89,791,765 (−0.62%)

Block 24003902

RVR execution: #664, this PR.

metric #664 this PR delta
execute_metered_insns 512,092,682 511,200,060 −892,622 (−0.17%)
metered_rows_unpadded 692,838,316 691,954,121 −884,195 (−0.13%)
metered_main_cells_unpadded 30,149,424,975 30,054,639,856 −94,785,119 (−0.31%)
metered_interaction_cells_unpadded 11,994,791,134 11,974,365,720 −20,425,414 (−0.17%)
metered_memory_unpadded_bytes 575,266,433,578 574,055,559,407 −1,210,874,171 (−0.21%)
memory-triggered segment cuts 51 51 0

@Qumeric

Qumeric commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #683 — same change, reparented onto develop-v2.1.0. It touches only crates/stateless-executor/src/io.rs, so being stacked mid-series was incidental; it applies to develop with no conflicts and an identical diff.

@Qumeric Qumeric closed this Jul 28, 2026
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