Skip to content

Conversation

@MarcosNicolau
Copy link
Contributor

@MarcosNicolau MarcosNicolau commented Mar 20, 2025

Motivation
Increase performance.

Description
Implements parallel execution with pevm for revm vm engine. A load execution bench with 10 blocks of 1_000_000_000 gas (~47 transactions per block) composed of random raw transfers between 1 million wallets throw an increase in 1.8x on an macbook M4 pro (the sequential execution took 23s and parallel 13s).

Here are the respective flamegraphs:

We should do more load tests with ERC-20 and Uniswap swaps and see the gain in those cases. As stated here by pevm, we should see an increase of around:

  • 4x for ERC20 transfers
  • 22x for Uniswap swaps.

Considerations

  • pevm utilizes snmalloc for memory allocation, for which CMAKE is necessary, so it was added to the Dockefiles and workflows.
  • We had to fork pevm to support other chains other than mainnet. We should consider opening a pr to the oficial repo or fork our own.

References

Closes #2264

@MarcosNicolau MarcosNicolau changed the title feat: integrate pevm feat(core): integrate pevm Mar 20, 2025
@github-actions
Copy link

github-actions bot commented Mar 20, 2025

Lines of code report

Total lines added: 365
Total lines removed: 0
Total lines changed: 365

Detailed view
+----------------------------------------------+-------+------+
| File                                         | Lines | Diff |
+----------------------------------------------+-------+------+
| ethrex/crates/vm/backends/mod.rs             | 371   | +24  |
+----------------------------------------------+-------+------+
| ethrex/crates/vm/backends/revm/mod.rs        | 730   | +114 |
+----------------------------------------------+-------+------+
| ethrex/crates/vm/backends/revm/pevm_utils.rs | 225   | +225 |
+----------------------------------------------+-------+------+
| ethrex/crates/vm/errors.rs                   | 119   | +2   |
+----------------------------------------------+-------+------+

@MarcosNicolau MarcosNicolau added the performance Block execution throughput and performance in general label Mar 20, 2025
"serde",
], package = "revm" }
# global-alloc makes it a 25% faster approx but it might crash in arm system
pevm = { git = "https://github.com/MarcosNicolau/pevm.git", branch = "main", features = ["global-alloc"]}
Copy link
Contributor Author

@MarcosNicolau MarcosNicolau Mar 25, 2025

Choose a reason for hiding this comment

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

Note: I had to fork pevm library to support other chains, we should try consider opening a pr to the oficial pevm repo or fork own ourselves. Here you can see the diff: (MarcosNicolau/pevm@5d175d1).

@MarcosNicolau MarcosNicolau marked this pull request as ready for review March 27, 2025 14:52
@MarcosNicolau MarcosNicolau requested a review from a team as a code owner March 27, 2025 14:52
@github-actions
Copy link

github-actions bot commented Mar 27, 2025

Benchmark Block Execution Results Comparison Against Main

Command Mean [s] Min [s] Max [s] Relative
base 188.309 ± 0.759 187.413 189.925 1.00
head 505.552 ± 18.172 467.273 531.959 2.68 ± 0.10

@jrchatruc
Copy link
Collaborator

Closing, we'll redo this using the updated EVM abstraction

@jrchatruc jrchatruc closed this Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Block execution throughput and performance in general

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BlockSTM: pevm integration

3 participants