perf(precompiles): allocation-free EvmInternals account access#5623
Draft
mattsse wants to merge 1 commit into
Draft
perf(precompiles): allocation-free EvmInternals account access#5623mattsse wants to merge 1 commit into
mattsse wants to merge 1 commit into
Conversation
Migrate the hot storage paths (sload, sstore, set_code) in the EVM precompile storage provider to the new EvmInternals::with_account_mut / try_with_account_mut visitor API, which loads the journaled account without boxing it on every access. Patches alloy-evm to the matt/evm-internals-with-account branch to benchmark the impact. with_account_info stays on the boxed API since its gas accounting needs the cold-load flag between load and code load.
Contributor
Author
|
derek bench |
Member
|
cc @mattsse ❌ Benchmark complete: Regression View job ❌ Bench Comparison: RegressionRefs: main vs matt/bench-evm-with-account Configuration
Tempo Metrics
Builder
Builder details
Validator
Observability |
Contributor
Author
|
derek bench samply=true run-pairs=2 |
Member
|
cc @mattsse
|
| Metric | Baseline | Feature | Delta |
|---|---|---|---|
| TPS Mean | 20382 | 20099 | -1.39% ❌ (+/-0.32/floor 0.55) |
| Gas Throughput [Mgas/s] | 1036.1 | 1021.7 | -1.39% ❌ (+/-0.32/floor 0.50) |
| Block Time Mean [ms] | 556.0 | 554.5 | -0.27% ⚪ (+/-0.47/floor 0.40) |
| Block Time P50 [ms] | 554.0 | 556.0 | +0.36% ⚪ (+/-0.81/floor 0.70) |
| Block Time P90 [ms] | 596.0 | 587.0 | -1.51% ✅ (+/-0.59/floor 0.70) |
| Block Time P99 [ms] | 627.0 | 625.0 | -0.32% ⚪ (+/-1.99/floor 1.60) |
| Serialized Block Size / Tx P50 [B/tx] | 251.1 | 251.1 | +0.00% ⚪ (+/-0.00/floor 0.70) |
| Serialized Block Size / Tx P90 [B/tx] | 251.1 | 251.1 | +0.00% ⚪ (+/-0.00/floor 0.70) |
| Serialized Block Size / Tx P99 [B/tx] | 251.1 | 251.1 | +0.00% ⚪ (+/-0.00/floor 0.70) |
Builder
| Metric | Baseline | Feature | Delta |
|---|---|---|---|
| Gas Throughput [Mgas/s] | 2516.0 | 2464.6 | -2.04% ❌ (+/-0.61/floor 0.95) |
| P50 [ms] | 228.2 | 229.6 | +0.61% ⚪ (+/-1.05/floor 0.45) |
| P90 [ms] | 240.7 | 240.7 | +0.00% ⚪ (+/-0.15/floor 0.90) |
| P99 [ms] | 255.8 | 259.4 | +1.41% ⚪ (+/-1.17/floor 1.25) |
Builder details
| Metric | Baseline | Feature | Delta |
|---|---|---|---|
| Finish P50 [ms] | 22.3 | 21.5 | -3.59% |
| Finish P90 [ms] | 32.3 | 29.6 | -8.36% |
| Finish P99 [ms] | 45.8 | 44.8 | -2.18% |
| Pool Fetch P50 [ms] | 6.1 | 6.9 | +13.11% |
| Pool Fetch P90 [ms] | 19.7 | 20.5 | +4.06% |
| Pool Fetch P99 [ms] | 27.9 | 29.8 | +6.81% |
| Included Tx Exec P50 [ms] | - | - | |
| Included Tx Exec P90 [ms] | - | - | |
| Included Tx Exec P99 [ms] | - | - | |
| Invalid Tx Exec P50 [ms] | - | - | |
| Invalid Tx Exec P90 [ms] | - | - | |
| Invalid Tx Exec P99 [ms] | - | - | |
| Invalid Tx Attempts P50 | 0.0 | 0.0 | 0.00% |
| Invalid Tx Attempts P90 | 0.0 | 0.0 | 0.00% |
| Invalid Tx Attempts P99 | 0.0 | 0.0 | 0.00% |
| Invalid Tx Skips | 0 | 0 | 0.00% |
| Nonce Too Low Skips | 0 | 0 | 0.00% |
| Serialized Block Size P50 [KiB] | 2809.7 | 2771.2 | -1.37% |
| Serialized Block Size P90 [KiB] | 3092.1 | 3025.4 | -2.16% |
| Serialized Block Size P99 [KiB] | 3510.5 | 3274.2 | -6.73% |
| Fill Overhead P50 [ms] | - | - | |
| Fill Overhead P90 [ms] | - | - | |
| Fill Overhead P99 [ms] | - | - | |
| Fill Idle P50 [ms] | 0.0 | 0.0 | 0.00% |
| Fill Idle P90 [ms] | 0.0 | 0.0 | 0.00% |
| Fill Idle P99 [ms] | 67.0 | 60.0 | -10.45% |
Validator
| Metric | Baseline | Feature | Delta |
|---|---|---|---|
| Gas Throughput [Mgas/s] | 2381.0 | 2335.1 | -1.93% ❌ (+/-0.36/floor 0.65) |
| P50 [ms] | 242.8 | 244.0 | +0.49% ⚪ (+/-0.97/floor 1.55) |
| P90 [ms] | 265.0 | 266.9 | +0.72% ⚪ (+/-1.21/floor 1.55) |
| P99 [ms] | 283.4 | 278.9 | -1.59% ⚪ (+/-1.02/floor 2.05) |
Observability
Samply Profiles
- feature-1 / a: Firefox Profiler
- feature-1 / b: Firefox Profiler
- baseline-1 / a: Firefox Profiler
- baseline-1 / b: Firefox Profiler
- baseline-2 / a: Firefox Profiler
- baseline-2 / b: Firefox Profiler
- feature-2 / a: Firefox Profiler
- feature-2 / b: Firefox Profiler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Benchmarks the allocation-free account access API added in alloy-evm (mattsse/evm#matt/evm-internals-with-account).
Loading a journaled account through
EvmInternalspreviously boxed the journal's GAT-typed account on every access — one heap allocation persload/sstore/set_code. The newwith_account_mut/try_with_account_mutvisitor methods pass the account to a closure as a stack&mut dyn JournaledAccountTrinstead, so no allocation is needed.This PR patches
alloy-evmto that branch and migrates the hot storage paths inEvmPrecompileStorageProvider(sload,sstore,set_code) to the visitor API.with_account_infois left on the boxed API for now because its gas accounting needs the cold-load flag in between loading the account and loading its code, which the visitor doesn't expose.Draft for benchmarking only — the
alloy-evmgit patch must be replaced with a released version before merge.ref #5132