Skip to content

perf(levm): remove repeated get_account_info calls in LEVM#2357

Merged
avilagaston9 merged 4 commits into
mainfrom
levm/perf/cache_get_state_transitions
Mar 31, 2025
Merged

perf(levm): remove repeated get_account_info calls in LEVM#2357
avilagaston9 merged 4 commits into
mainfrom
levm/perf/cache_get_state_transitions

Conversation

@avilagaston9

@avilagaston9 avilagaston9 commented Mar 28, 2025

Copy link
Copy Markdown
Contributor

Motivation

Noticed on #2292 that the majority of the time in LEVM::get_state_transitions() was spent on calls to get_account_info(). While looking for areas to improve, I found that we were calling get_account_info() three times instead of reusing the value returned in the first call.

Description

Removes the repeated calls to get_account_info.

Testing locally shows a 2x speed improvement in payload_builder::build_payload() implemented in #2292.

Closes None

@github-actions

github-actions Bot commented Mar 28, 2025

Copy link
Copy Markdown

Lines of code report

Total lines added: 0
Total lines removed: 1
Total lines changed: 1

Detailed view
+---------------------------------------+-------+------+
| File                                  | Lines | Diff |
+---------------------------------------+-------+------+
| ethrex/crates/vm/backends/levm/mod.rs | 568   | -1   |
+---------------------------------------+-------+------+

@avilagaston9 avilagaston9 changed the title levm(perf): cache AccountInfo to reduce get_account_info calls perf(levm): cache AccountInfo to reduce get_account_info calls Mar 28, 2025
@avilagaston9 avilagaston9 self-assigned this Mar 28, 2025
@avilagaston9 avilagaston9 changed the title perf(levm): cache AccountInfo to reduce get_account_info calls perf(levm): remove repeated get_account_info calls in LEVM Mar 30, 2025
@avilagaston9 avilagaston9 marked this pull request as ready for review March 31, 2025 13:25
@avilagaston9 avilagaston9 requested a review from a team as a code owner March 31, 2025 13:25
@avilagaston9 avilagaston9 added this pull request to the merge queue Mar 31, 2025

@Oppen Oppen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

Merged via the queue into main with commit c18d692 Mar 31, 2025
@avilagaston9 avilagaston9 deleted the levm/perf/cache_get_state_transitions branch March 31, 2025 14:35
pedrobergamini pushed a commit to pedrobergamini/ethrex that referenced this pull request Aug 24, 2025
…lass#2357)

**Motivation**

Noticed on lambdaclass#2292 that the majority of the time in
`LEVM::get_state_transitions()` was spent on calls to
`get_account_info()`. While looking for areas to improve, I found that
we were calling `get_account_info()` three times instead of reusing the
value returned in the first call.

**Description**

Removes the repeated calls to `get_account_info`.

Testing locally shows a `2x` speed improvement in
`payload_builder::build_payload()` implemented in lambdaclass#2292.

Closes None
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.

4 participants