Skip to content

Conversation

@DaniPopes
Copy link
Collaborator

@DaniPopes DaniPopes commented Jul 22, 2025

Various interpreter improvements. See individual commits.

It's more accessed than host, and when calling a function that
takes interpreter as the first argument, no registers have to change.
This function massively bloats all callsites because it can drop
the previous action.
We want to write directly into the maybe-uninitialized memory
of the stack. We cannot do this using existing APIs, so we must
add `push_slice` to `StackTr`.
@codspeed-hq
Copy link

codspeed-hq bot commented Jul 22, 2025

CodSpeed Performance Report

Merging #2760 will improve performances by 33.39%

Comparing DaniPopes:interp-perfs (f47751d) with main (a5dd047)

Summary

⚡ 132 improvements
✅ 39 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
ADDMOD_50 33.5 µs 30.8 µs +8.88%
ADDRESS_50 19.3 µs 18.1 µs +6.79%
ADD_50 25.7 µs 23.2 µs +11.04%
AND_50 25.8 µs 23.2 µs +11.36%
BYTE_50 26.1 µs 23.5 µs +11.4%
CALLDATACOPY_50 59.1 µs 56.5 µs +4.56%
CALLDATALOAD_50 60.2 µs 57.5 µs +4.62%
CALLDATASIZE_50 19.3 µs 18.1 µs +6.95%
CALLER_50 19.3 µs 18.1 µs +6.79%
CALLVALUE_50 19.2 µs 18 µs +6.99%
CALL_50 105.5 µs 96.2 µs +9.67%
CHAINID_50 19.3 µs 18 µs +7.13%
CLZ_50 24.3 µs 22.5 µs +7.97%
CODESIZE_50 19.3 µs 18.1 µs +7.12%
COINBASE_50 19.4 µs 18.1 µs +7.1%
DELEGATECALL_50 99.6 µs 90.7 µs +9.84%
DIFFICULTY_50 19.5 µs 18.3 µs +6.88%
DIV_50 28.2 µs 25.9 µs +8.91%
DUP10_50 25.7 µs 23.1 µs +11.15%
DUP11_50 25.9 µs 23.3 µs +11.17%
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

@mattsse
Copy link
Collaborator

mattsse commented Jul 22, 2025

das feuer bruder

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

🔥 all of this checks out afaict

The compiler does not elide the "not Some" check after inlining
`popn_top`. See rust-lang/rust#144329.
Move runtime checks to debug mode only.
@rakita
Copy link
Member

rakita commented Jul 23, 2025

Awesome finds! It looks that the biggest thing is marking fn halt as cold.

it is unfortunate that degradation didn't happened on PR when this fn was introduced but in EOF removal PR where code was removed, I guess with code removed the compiler switched its strategy for this fn from not inlining to inlining.

https://codspeed.io/bluealloy/revm/benchmarks/bins/revme/benches/evm.rs::benches::evm::snailtracer?runnerMode=Instrumentation

@rakita rakita merged commit 0b9ca9b into bluealloy:main Jul 23, 2025
29 checks passed
@github-actions github-actions bot mentioned this pull request Jul 23, 2025
@DaniPopes DaniPopes deleted the interp-perfs branch July 23, 2025 10:34
This was referenced Jul 23, 2025
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.

3 participants