Skip to content

perf(precompiles): allocation-free EvmInternals account access#5623

Draft
mattsse wants to merge 1 commit into
mainfrom
matt/bench-evm-with-account
Draft

perf(precompiles): allocation-free EvmInternals account access#5623
mattsse wants to merge 1 commit into
mainfrom
matt/bench-evm-with-account

Conversation

@mattsse

@mattsse mattsse commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Benchmarks the allocation-free account access API added in alloy-evm (mattsse/evm#matt/evm-internals-with-account).

Loading a journaled account through EvmInternals previously boxed the journal's GAT-typed account on every access — one heap allocation per sload/sstore/set_code. The new with_account_mut / try_with_account_mut visitor methods pass the account to a closure as a stack &mut dyn JournaledAccountTr instead, so no allocation is needed.

This PR patches alloy-evm to that branch and migrates the hot storage paths in EvmPrecompileStorageProvider (sload, sstore, set_code) to the visitor API. with_account_info is 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-evm git patch must be replaced with a released version before merge.

ref #5132

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.
@mattsse

mattsse commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

derek bench

@decofe

decofe commented Jun 11, 2026

Copy link
Copy Markdown
Member

cc @mattsse

❌ Benchmark complete: Regression View job

❌ Bench Comparison: Regression

Refs: main vs matt/bench-evm-with-account
Criteria: 95% run-bootstrap CI must clear floor; cells show delta (+/-CI/floor).

Configuration

  • Derek command: derek bench mode=e2e preset=tip20 duration=90 bloat=100 tps=50000 accounts=1000 max-concurrent-requests=500 baseline=main feature=matt/bench-evm-with-account baseline-hardfork="" feature-hardfork="" gas-limit=1000000000 run-pairs=3 otlp=true metrics=false no-cache=false force-bloat=false
  • Bloat: 100000 MiB
  • Preset: tip20
  • Target TPS: 50000
  • Duration: 90s
  • Run pairs: 3
  • Baseline blocks: 489
  • Feature blocks: 489

Tempo Metrics

Metric Baseline Feature Delta
TPS Mean 21415 21311 -0.49% ⚪ (+/-0.59/floor 0.55)
Gas Throughput [Mgas/s] 1088.6 1083.4 -0.48% ⚪ (+/-0.59/floor 0.50)
Block Time Mean [ms] 551.9 549.1 -0.51% ⚪ (+/-0.43/floor 0.40)
Block Time P50 [ms] 554.0 551.0 -0.54% ⚪ (+/-0.36/floor 0.70)
Block Time P90 [ms] 586.0 580.0 -1.02% ⚪ (+/-0.65/floor 0.70)
Block Time P99 [ms] 617.0 614.0 -0.49% ⚪ (+/-2.11/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] 2607.6 2560.8 -1.80% ❌ (+/-0.43/floor 0.95)
P50 [ms] 231.3 231.8 +0.22% ⚪ (+/-0.37/floor 0.45)
P90 [ms] 239.6 240.2 +0.25% ⚪ (+/-0.36/floor 0.90)
P99 [ms] 279.9 272.3 -2.72% ⚪ (+/-6.08/floor 1.25)
Builder details
Metric Baseline Feature Delta
Finish P50 [ms] 19.3 18.7 -3.11%
Finish P90 [ms] 26.1 24.4 -6.51%
Finish P99 [ms] 32.0 32.4 +1.25%
Pool Fetch P50 [ms] 9.4 8.8 -6.38%
Pool Fetch P90 [ms] 23.2 23.6 +1.72%
Pool Fetch P99 [ms] 28.4 29.6 +4.23%
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] 2965.8 2892.8 -2.46%
Serialized Block Size P90 [KiB] 3237.9 3166.6 -2.20%
Serialized Block Size P99 [KiB] 3514.7 3458.3 -1.60%
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] 108.0 97.0 -10.19%

Validator

Metric Baseline Feature Delta
Gas Throughput [Mgas/s] 2572.8 2541.2 -1.23% ❌ (+/-0.44/floor 0.65)
P50 [ms] 237.1 235.8 -0.55% ⚪ (+/-1.01/floor 1.55)
P90 [ms] 256.9 256.4 -0.19% ⚪ (+/-1.21/floor 1.55)
P99 [ms] 278.6 272.2 -2.30% ⚪ (+/-2.90/floor 2.05)

Observability

@mattsse

mattsse commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

derek bench samply=true run-pairs=2

@decofe

decofe commented Jun 11, 2026

Copy link
Copy Markdown
Member

cc @mattsse

⚠️ Benchmark complete: Mixed Results View job

⚠️ Bench Comparison: Mixed Results

Refs: main vs matt/bench-evm-with-account
Criteria: 95% run-bootstrap CI must clear floor; cells show delta (+/-CI/floor).

Configuration

  • Derek command: derek bench mode=e2e preset=tip20 duration=90 bloat=100 tps=50000 accounts=1000 max-concurrent-requests=500 baseline=main feature=matt/bench-evm-with-account baseline-hardfork="" feature-hardfork="" gas-limit=1000000000 run-pairs=2 otlp=true metrics=false no-cache=false force-bloat=false samply
  • Bloat: 100000 MiB
  • Preset: tip20
  • Target TPS: 50000
  • Duration: 90s
  • Run pairs: 2
  • Baseline blocks: 319
  • Feature blocks: 320

Tempo Metrics

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

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.

2 participants