Skip to content

perf: cache selfbalance and prevrandao values#3538

Open
rakita wants to merge 1 commit intomainfrom
caching
Open

perf: cache selfbalance and prevrandao values#3538
rakita wants to merge 1 commit intomainfrom
caching

Conversation

@rakita
Copy link
Copy Markdown
Member

@rakita rakita commented Apr 2, 2026

Summary

  • Cache selfbalance in Interpreter via Option<Box<U256>> to avoid repeated host balance lookups within the same frame. Cleared on clear() (frame init).
  • Cache prevrandao in LocalContext via Option<Box<U256>> since it is constant per block. Added prevrandao() method to LocalContextTr trait. Changed Host::prevrandao from &self to &mut self to allow caching.

Test plan

  • cargo build passes
  • cargo build -p op-revm passes
  • cargo clippy clean

Cache selfbalance in the Interpreter via Option<Box<U256>> to avoid
repeated host balance lookups within the same frame. Cache prevrandao
in LocalContext via the same pattern since it is constant per block.
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