Skip to content

feat(evm_interpreter): specialize PUSH3..PUSH8 via a u64-sized helper#648

Open
0xVolosnikov wants to merge 1 commit into
draft-0.4.0from
vv-push-small-specializations
Open

feat(evm_interpreter): specialize PUSH3..PUSH8 via a u64-sized helper#648
0xVolosnikov wants to merge 1 commit into
draft-0.4.0from
vv-push-small-specializations

Conversation

@0xVolosnikov
Copy link
Copy Markdown
Contributor

What ❔

Add a single push_small<const N: usize>() helper that specializes PUSH3..PUSH8 in the EVM interpreter, in the same spirit as the existing PUSH1 and PUSH2 specializations (PR #646).

All of PUSH3..PUSH8 fit in a u64 (≤ 8 bytes of payload), but were routed through the generic push<const N: usize>() path, which copies bytecode bytes into a U256, byte-reverses the full 32-byte value, and right-shifts off the unused high bytes. That work is unnecessary for small N.

The new helper:

  • Common case (in-bounds bytecode): copy the N payload bytes into the high end of an [u8; 8] buffer, then decode via u64::from_be_bytes. One bounds check, one chunk copy, one byte-swap.
  • Truncated-bytecode tail: per-byte zero-padded loop matching the generic path's right-padding semantics.

Both paths produce the same u64 the generic path would yield, then push it directly via EvmStack::push_u64.

Dispatch in interpreter.rs swaps self.push::<N>() for self.push_small::<N>() for N in 3..=8. PUSH1 and PUSH2 keep their bespoke specializations (each is simple enough that a helper would obscure rather than simplify).

Why ❔

Stacks on top of PR #646 (PUSH2 specialization). With PUSH2 specialized alone, PUSH3..PUSH8 collectively still represent a meaningful slice of opcode cycles in benchmark blocks. Bringing them to PUSH1/PUSH2 parity (~67-85 cycles each instead of ~144-175) saves real cycles per call and continues the cleanup of the same hot path.

Benchmark

bench_scripts/bench.sh compare, baseline = vv-push2-specialization HEAD (i.e. PUSH2 already specialized):

Block Base Eff Head Eff Δ
block_19299001 208,664,035 208,011,772 −0.31% (−652K cycles)
block_22244135 134,713,085 134,167,657 −0.40% (−545K cycles)

Per-opcode (block_19299001):

Opcode Count Median Δ Median Δ Total
PUSH3 500 73 −49.7% −47.8%
PUSH4 7849 73 −48.2% −48.8% (−545K cycles)
PUSH5 192 77 −47.6% −47.4%
PUSH6 90 82 −45.7% −46.3%
PUSH7 95 85 −51.1% −50.8%
PUSH8 1025 83 −48.4% −47.7% (−78K cycles)

Delegations (Blake / BigInt / Keccak): unchanged.

Incremental verification

The work was benchmarked in two stages on the same baseline:

  • Stage 1 (PUSH3..PUSH5 only): block_19299001 −0.28% / block_22244135 −0.40%.
  • Stage 2 (PUSH3..PUSH8): block_19299001 −0.31% / block_22244135 −0.40%.

Stage 2 adds PUSH6..PUSH8 on top of Stage 1 and improves block_19299001 by an additional ~70K cycles without making block_22244135 worse — confirming that extending the specialization through N=8 is still net positive despite the larger binary.

Notes on cross-opcode effects

Some other opcodes show small positive regressions (PUSH1 +1.6%, PUSH2 +1.5%, MLOAD +2.4%, CALLDATALOAD +4.4%, EQ +4.6%). These are consistent with the I-cache sensitivity already known on this interpreter loop — adding code to the dispatch hot path shifts neighbor instructions. The block-level effective-cycle savings dominate, but reviewers should be aware.

Is this a breaking change?

  • Yes
  • No

No protocol-visible behavior change. Gas and native cost charging are unchanged. The pushed value is bit-for-bit identical to the generic path on all inputs, including the truncated-bytecode edge case.

Checklist

  • PR title corresponds to the body of PR.
  • Tests for the changes have been added / updated.
    • Existing tests cover all PUSH semantics (Ethereum spec fixtures + interpreter rig tests). No semantic change → no new tests needed. Verified locally: cargo test -p evm_interpreter --features testing (13/13), tests/instances/evm (14/14).
  • Documentation comments have been added / updated.
  • Code has been formatted.

Base branch note

This PR targets vv-push2-specialization (PR #646). When that lands into custom-u256, this PR's base can be retargeted to custom-u256.

🤖 Generated with Claude Code

@0xVolosnikov 0xVolosnikov requested a review from ly0va May 14, 2026 12:11
@0xVolosnikov 0xVolosnikov force-pushed the vv-push2-specialization branch from 99c8d5c to 1901bd2 Compare May 15, 2026 12:35
@0xVolosnikov 0xVolosnikov force-pushed the vv-push-small-specializations branch from 509586e to 7a3b337 Compare May 15, 2026 12:45
Base automatically changed from vv-push2-specialization to draft-0.4.0 May 15, 2026 13:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes EVM PUSH3 through PUSH8 handling by routing them through a new u64-based helper instead of the generic U256 path, reducing work in the interpreter hot path while preserving existing PUSH semantics.

Changes:

  • Added push_small<const N>() for PUSH3..=PUSH8, including truncated-bytecode zero-padding behavior.
  • Updated opcode dispatch to use the new helper for PUSH3 through PUSH8.
  • Left PUSH1, PUSH2, and PUSH9..PUSH32 on their existing specialized/generic paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
evm_interpreter/src/interpreter.rs Routes PUSH3..PUSH8 opcodes to the new small push helper.
evm_interpreter/src/instructions/stack.rs Adds the push_small helper that assembles small PUSH payloads into a u64.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@0xVolosnikov 0xVolosnikov requested a review from AntonD3 May 19, 2026 14:54
PUSH3..PUSH8 all fit in a u64 but were going through the generic
push<const N: usize> path, which copies bytes into a U256, byte-reverses
the full 32-byte value, and shifts off the unused high bytes. That work is
unnecessary when the payload is <= 8 bytes.

Add a single `push_small<const N: usize>` helper that:
- in the common (in-bounds) case, copies the N payload bytes into the high
  end of an [u8; 8] buffer and decodes via `u64::from_be_bytes`;
- on the truncated-bytecode tail, falls back to a per-byte zero-padded loop.

Either path produces the same u64 the generic path would yield, then pushes
it directly via EvmStack::push_u64 — skipping the bytereverse + shift.

Dispatch in interpreter.rs swaps `self.push::<N>()` for `self.push_small::<N>()`
for N in 3..=8. PUSH1 and PUSH2 keep their bespoke specializations.

Benchmark (bench_scripts/bench.sh compare against PUSH2-specialized baseline):
- block_19299001 process_block: -0.31% effective (-652K cycles)
- block_22244135 process_block: -0.40% effective (-545K cycles)
- PUSH3 median: 144 -> 73 cycles (-49.7%)
- PUSH4 median: 142 -> 73 cycles (-48.2%), total -545K cycles
- PUSH5 median: 147 -> 77 cycles (-47.6%)
- PUSH6 median: 152 -> 82 cycles (-45.7%)
- PUSH7 median: 175 -> 85 cycles (-51.1%)
- PUSH8 median: 162 -> 83 cycles (-48.4%)
- Delegations (Blake/BigInt/Keccak): unchanged

Some other opcodes show small positive regressions (PUSH1 +1.6%, PUSH2 +1.5%,
MLOAD +2.4%, CALLDATALOAD +4.4%, EQ +4.6%) consistent with the I-cache
sensitivity already known on this interpreter loop. The net block-level
effective-cycle savings dominate.

Intermediate stage 1 (PUSH3..PUSH5 only) showed -0.28%/-0.40%; stage 2
(PUSH3..PUSH8) improves block_19299001 to -0.31% without further regression
elsewhere.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@0xVolosnikov 0xVolosnikov force-pushed the vv-push-small-specializations branch from fe7dde7 to f86d12d Compare May 29, 2026 20:29
@github-actions
Copy link
Copy Markdown
Contributor

Block-level effective cycles

Average across all block fixtures (process_block). Per-block breakdown below.

Benchmark Symbol Base Eff Head Eff (%) Base Raw Head Raw (%) Base Blake Head Blake (%) Base Bigint Head Bigint (%) Base Keccak Head Keccak (%)
all blocks (keccak DA) process_block 653,615,266 651,939,254 (-0.26%) 521,930,182 520,254,171 (-0.32%) 781,526 781,526 (+0.00%) 23,323,469 23,323,469 (+0.00%) 6,471,698 6,471,698 (+0.00%)
all blocks (blobs DA) process_block 701,866,111 700,190,099 (-0.24%) 559,084,359 557,408,348 (-0.30%) 791,605 791,605 (+0.00%) 26,365,011 26,365,011 (+0.00%) 6,164,007 6,164,007 (+0.00%)
Per-block effective cycles
Benchmark Symbol Base Eff Head Eff (%) Base Raw Head Raw (%) Base Blake Head Blake (%) Base Bigint Head Bigint (%) Base Keccak Head Keccak (%)
block_25188855 (keccak DA) process_block 237,657,747 236,841,489 (-0.34%) 184,564,543 183,748,285 (-0.44%) 498,230 498,230 (+0.00%) 8,457,231 8,457,231 (+0.00%) 2,823,150 2,823,150 (+0.00%)
block_25188855 (blobs DA) process_block 286,593,796 285,777,538 (-0.28%) 221,896,328 221,080,070 (-0.37%) 502,810 502,810 (+0.00%) 11,479,512 11,479,512 (+0.00%) 2,683,615 2,683,615 (+0.00%)
block_25188862 (keccak DA) process_block 549,525,194 547,798,434 (-0.31%) 421,362,246 419,635,486 (-0.41%) 831,340 831,340 (+0.00%) 22,892,549 22,892,549 (+0.00%) 5,822,828 5,822,828 (+0.00%)
block_25188862 (blobs DA) process_block 598,065,527 596,338,767 (-0.29%) 458,731,071 457,004,311 (-0.38%) 841,550 841,550 (+0.00%) 25,956,106 25,956,106 (+0.00%) 5,511,308 5,511,308 (+0.00%)
block_25188863 (keccak DA) process_block 229,913,146 229,208,897 (-0.31%) 177,029,506 176,325,257 (-0.40%) 419,790 419,790 (+0.00%) 8,150,725 8,150,725 (+0.00%) 3,391,025 3,391,025 (+0.00%)
block_25188863 (blobs DA) process_block 279,011,984 278,307,735 (-0.25%) 214,500,872 213,796,623 (-0.33%) 424,750 424,750 (+0.00%) 11,188,970 11,188,970 (+0.00%) 3,239,808 3,239,808 (+0.00%)
block_25188937 (keccak DA) process_block 720,636,582 717,208,125 (-0.48%) 566,510,310 563,081,853 (-0.61%) 1,209,910 1,209,910 (+0.00%) 21,884,022 21,884,022 (+0.00%) 11,807,906 11,807,906 (+0.00%)
block_25188937 (blobs DA) process_block 767,802,154 764,373,697 (-0.45%) 603,146,270 599,717,813 (-0.57%) 1,224,860 1,224,860 (+0.00%) 24,913,521 24,913,521 (+0.00%) 11,351,010 11,351,010 (+0.00%)
block_25188945 (keccak DA) process_block 421,930,894 420,472,984 (-0.35%) 341,291,474 339,833,564 (-0.43%) 930,920 930,920 (+0.00%) 11,233,142 11,233,142 (+0.00%) 5,203,033 5,203,033 (+0.00%)
block_25188945 (blobs DA) process_block 469,735,767 468,277,857 (-0.31%) 378,396,423 376,938,513 (-0.39%) 945,470 945,470 (+0.00%) 14,294,488 14,294,488 (+0.00%) 4,758,468 4,758,468 (+0.00%)
block_25188950 (keccak DA) process_block 538,248,623 537,032,971 (-0.23%) 433,143,227 431,927,575 (-0.28%) 659,000 659,000 (+0.00%) 19,210,924 19,210,924 (+0.00%) 4,429,425 4,429,425 (+0.00%)
block_25188950 (blobs DA) process_block 587,289,794 586,074,142 (-0.21%) 470,656,926 469,441,274 (-0.26%) 665,270 665,270 (+0.00%) 22,259,167 22,259,167 (+0.00%) 4,237,970 4,237,970 (+0.00%)
block_25189014 (keccak DA) process_block 379,907,714 378,528,382 (-0.36%) 296,127,822 294,748,490 (-0.47%) 577,680 577,680 (+0.00%) 13,434,465 13,434,465 (+0.00%) 5,199,788 5,199,788 (+0.00%)
block_25189014 (blobs DA) process_block 428,986,903 427,607,571 (-0.32%) 333,597,727 332,218,395 (-0.41%) 582,880 582,880 (+0.00%) 16,474,342 16,474,342 (+0.00%) 5,041,432 5,041,432 (+0.00%)
block_25189128 (keccak DA) process_block 426,196,711 424,348,304 (-0.43%) 342,425,715 340,577,308 (-0.54%) 773,970 773,970 (+0.00%) 11,463,305 11,463,305 (+0.00%) 6,383,564 6,383,564 (+0.00%)
block_25189128 (blobs DA) process_block 474,334,839 472,486,432 (-0.39%) 379,623,879 377,775,472 (-0.49%) 786,150 786,150 (+0.00%) 14,521,453 14,521,453 (+0.00%) 6,011,687 6,011,687 (+0.00%)
block_25189151 (keccak DA) process_block 732,173,781 729,563,745 (-0.36%) 556,213,169 553,603,133 (-0.47%) 1,085,470 1,085,470 (+0.00%) 29,031,931 29,031,931 (+0.00%) 10,616,342 10,616,342 (+0.00%)
block_25189151 (blobs DA) process_block 779,212,290 776,602,254 (-0.33%) 592,997,650 590,387,614 (-0.44%) 1,104,220 1,104,220 (+0.00%) 32,092,856 32,092,856 (+0.00%) 10,043,924 10,043,924 (+0.00%)
block_25189153 (keccak DA) process_block 2,299,962,265 2,298,389,213 (-0.07%) 1,900,633,813 1,899,060,761 (-0.08%) 828,950 828,950 (+0.00%) 87,476,392 87,476,392 (+0.00%) 9,039,921 9,039,921 (+0.00%)
block_25189153 (blobs DA) process_block 2,347,628,053 2,346,055,001 (-0.07%) 1,937,296,445 1,935,723,393 (-0.08%) 838,090 838,090 (+0.00%) 90,469,691 90,469,691 (+0.00%) 8,760,851 8,760,851 (+0.00%)
Block-level sub-phases
Benchmark Symbol Base Eff Head Eff (%) Base Raw Head Raw (%) Base Blake Head Blake (%) Base Bigint Head Bigint (%) Base Keccak Head Keccak (%)
block_25188855 (blobs DA) blob_versioned_hash 49,929,644 49,929,644 (+0.00%) 37,767,240 37,767,240 (+0.00%) 4,580 4,580 (+0.00%) 3,022,281 3,022,281 (+0.00%) 0 0 (+0.00%)
block_25188862 (blobs DA) blob_versioned_hash 50,786,889 50,786,889 (+0.00%) 38,369,301 38,369,301 (+0.00%) 10,210 10,210 (+0.00%) 3,063,557 3,063,557 (+0.00%) 0 0 (+0.00%)
block_25188863 (blobs DA) blob_versioned_hash 50,175,573 50,175,573 (+0.00%) 37,943,233 37,943,233 (+0.00%) 4,960 4,960 (+0.00%) 3,038,245 3,038,245 (+0.00%) 0 0 (+0.00%)
block_25188937 (blobs DA) blob_versioned_hash 50,405,427 50,405,427 (+0.00%) 38,048,231 38,048,231 (+0.00%) 14,950 14,950 (+0.00%) 3,029,499 3,029,499 (+0.00%) 0 0 (+0.00%)
block_25188945 (blobs DA) blob_versioned_hash 50,921,583 50,921,583 (+0.00%) 38,443,399 38,443,399 (+0.00%) 14,550 14,550 (+0.00%) 3,061,346 3,061,346 (+0.00%) 0 0 (+0.00%)
block_25188950 (blobs DA) blob_versioned_hash 50,411,534 50,411,534 (+0.00%) 38,118,242 38,118,242 (+0.00%) 6,270 6,270 (+0.00%) 3,048,243 3,048,243 (+0.00%) 0 0 (+0.00%)
block_25189014 (blobs DA) blob_versioned_hash 50,211,526 50,211,526 (+0.00%) 37,968,818 37,968,818 (+0.00%) 5,200 5,200 (+0.00%) 3,039,877 3,039,877 (+0.00%) 0 0 (+0.00%)
block_25189128 (blobs DA) blob_versioned_hash 50,778,496 50,778,496 (+0.00%) 38,351,024 38,351,024 (+0.00%) 12,180 12,180 (+0.00%) 3,058,148 3,058,148 (+0.00%) 0 0 (+0.00%)
block_25189151 (blobs DA) blob_versioned_hash 51,110,387 51,110,387 (+0.00%) 38,566,687 38,566,687 (+0.00%) 18,750 18,750 (+0.00%) 3,060,925 3,060,925 (+0.00%) 0 0 (+0.00%)
block_25189153 (blobs DA) blob_versioned_hash 49,654,213 49,654,213 (+0.00%) 37,534,777 37,534,777 (+0.00%) 9,140 9,140 (+0.00%) 2,993,299 2,993,299 (+0.00%) 0 0 (+0.00%)
block_25188855 (blobs DA) da_commitment 2,520,840 2,520,840 (+0.00%) 2,408,840 2,408,840 (+0.00%) 7,000 7,000 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188855 (keccak DA) da_commitment 3,513,442 3,513,442 (+0.00%) 2,845,898 2,845,898 (+0.00%) 7,000 7,000 (+0.00%) 0 0 (+0.00%) 138,886 138,886 (+0.00%)
block_25188862 (blobs DA) da_commitment 5,542,919 5,542,919 (+0.00%) 5,290,119 5,290,119 (+0.00%) 15,800 15,800 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188862 (keccak DA) da_commitment 7,785,080 7,785,080 (+0.00%) 6,288,796 6,288,796 (+0.00%) 15,800 15,800 (+0.00%) 0 0 (+0.00%) 310,871 310,871 (+0.00%)
block_25188863 (blobs DA) da_commitment 2,557,099 2,557,099 (+0.00%) 2,441,579 2,441,579 (+0.00%) 7,220 7,220 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188863 (keccak DA) da_commitment 3,629,435 3,629,435 (+0.00%) 2,911,643 2,911,643 (+0.00%) 7,220 7,220 (+0.00%) 0 0 (+0.00%) 150,568 150,568 (+0.00%)
block_25188937 (blobs DA) da_commitment 7,684,897 7,684,897 (+0.00%) 7,328,897 7,328,897 (+0.00%) 22,250 22,250 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188937 (keccak DA) da_commitment 10,920,391 10,920,391 (+0.00%) 8,739,403 8,739,403 (+0.00%) 22,250 22,250 (+0.00%) 0 0 (+0.00%) 456,247 456,247 (+0.00%)
block_25188945 (blobs DA) da_commitment 6,766,623 6,766,623 (+0.00%) 6,450,463 6,450,463 (+0.00%) 19,760 19,760 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188945 (keccak DA) da_commitment 9,878,984 9,878,984 (+0.00%) 7,787,160 7,787,160 (+0.00%) 19,760 19,760 (+0.00%) 0 0 (+0.00%) 443,916 443,916 (+0.00%)
block_25188950 (blobs DA) da_commitment 3,338,915 3,338,915 (+0.00%) 3,188,995 3,188,995 (+0.00%) 9,370 9,370 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188950 (keccak DA) da_commitment 4,700,642 4,700,642 (+0.00%) 3,787,498 3,787,498 (+0.00%) 9,370 9,370 (+0.00%) 0 0 (+0.00%) 190,806 190,806 (+0.00%)
block_25189014 (blobs DA) da_commitment 2,978,030 2,978,030 (+0.00%) 2,850,670 2,850,670 (+0.00%) 7,960 7,960 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189014 (keccak DA) da_commitment 4,106,010 4,106,010 (+0.00%) 3,347,822 3,347,822 (+0.00%) 7,960 7,960 (+0.00%) 0 0 (+0.00%) 157,707 157,707 (+0.00%)
block_25189128 (blobs DA) da_commitment 6,135,237 6,135,237 (+0.00%) 5,844,517 5,844,517 (+0.00%) 18,170 18,170 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189128 (keccak DA) da_commitment 8,771,258 8,771,258 (+0.00%) 6,995,626 6,995,626 (+0.00%) 18,170 18,170 (+0.00%) 0 0 (+0.00%) 371,228 371,228 (+0.00%)
block_25189151 (blobs DA) da_commitment 8,058,835 8,058,835 (+0.00%) 7,691,795 7,691,795 (+0.00%) 22,940 22,940 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189151 (keccak DA) da_commitment 12,126,349 12,126,349 (+0.00%) 9,472,233 9,472,233 (+0.00%) 22,940 22,940 (+0.00%) 0 0 (+0.00%) 571,769 571,769 (+0.00%)
block_25189153 (blobs DA) da_commitment 4,816,784 4,816,784 (+0.00%) 4,587,984 4,587,984 (+0.00%) 14,300 14,300 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189153 (keccak DA) da_commitment 6,800,863 6,800,863 (+0.00%) 5,458,379 5,458,379 (+0.00%) 14,300 14,300 (+0.00%) 0 0 (+0.00%) 278,421 278,421 (+0.00%)
block_25188855 (keccak DA) run_tx_loop 212,949,827 212,133,569 (-0.38%) 162,437,559 161,621,301 (-0.50%) 373,590 373,590 (+0.00%) 8,457,231 8,457,231 (+0.00%) 2,676,476 2,676,476 (+0.00%)
block_25188862 (keccak DA) run_tx_loop 500,660,710 498,933,950 (-0.34%) 377,720,718 375,993,958 (-0.46%) 584,570 584,570 (+0.00%) 22,892,549 22,892,549 (+0.00%) 5,504,169 5,504,169 (+0.00%)
block_25188863 (keccak DA) run_tx_loop 205,441,519 204,737,270 (-0.34%) 155,175,303 154,471,054 (-0.45%) 295,790 295,790 (+0.00%) 8,150,725 8,150,725 (+0.00%) 3,232,669 3,232,669 (+0.00%)
block_25188937 (keccak DA) run_tx_loop 646,275,755 642,847,298 (-0.53%) 499,927,863 496,499,406 (-0.69%) 839,770 839,770 (+0.00%) 21,884,022 21,884,022 (+0.00%) 11,343,871 11,343,871 (+0.00%)
block_25188945 (keccak DA) run_tx_loop 370,090,278 368,632,368 (-0.39%) 295,673,194 294,215,284 (-0.49%) 654,950 654,950 (+0.00%) 11,233,142 11,233,142 (+0.00%) 4,751,329 4,751,329 (+0.00%)
block_25188950 (keccak DA) run_tx_loop 505,472,781 504,257,129 (-0.24%) 403,796,161 402,580,509 (-0.30%) 494,350 494,350 (+0.00%) 19,210,924 19,210,924 (+0.00%) 4,230,831 4,230,831 (+0.00%)
block_25189014 (keccak DA) run_tx_loop 348,919,029 347,539,697 (-0.40%) 268,259,997 266,880,665 (-0.51%) 424,000 424,000 (+0.00%) 13,434,465 13,434,465 (+0.00%) 5,034,293 5,034,293 (+0.00%)
block_25189128 (keccak DA) run_tx_loop 374,412,182 372,563,775 (-0.49%) 296,517,090 294,668,683 (-0.62%) 501,480 501,480 (+0.00%) 11,463,305 11,463,305 (+0.00%) 6,004,548 6,004,548 (+0.00%)
block_25189151 (keccak DA) run_tx_loop 664,400,608 661,790,572 (-0.39%) 496,277,104 493,667,068 (-0.53%) 740,540 740,540 (+0.00%) 29,031,931 29,031,931 (+0.00%) 10,036,785 10,036,785 (+0.00%)
block_25189153 (keccak DA) run_tx_loop 2,252,330,275 2,250,757,223 (-0.07%) 1,857,998,019 1,856,424,967 (-0.08%) 588,240 588,240 (+0.00%) 87,476,392 87,476,392 (+0.00%) 8,753,712 8,753,712 (+0.00%)
block_25188855 (blobs DA) state_commitment_update 17,558,979 17,558,979 (+0.00%) 16,023,619 16,023,619 (+0.00%) 95,960 95,960 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188855 (keccak DA) state_commitment_update 17,555,562 17,555,562 (+0.00%) 16,020,202 16,020,202 (+0.00%) 95,960 95,960 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188862 (blobs DA) state_commitment_update 32,412,499 32,412,499 (+0.00%) 29,506,419 29,506,419 (+0.00%) 181,630 181,630 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188862 (keccak DA) state_commitment_update 32,412,499 32,412,499 (+0.00%) 29,506,419 29,506,419 (+0.00%) 181,630 181,630 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188863 (blobs DA) state_commitment_update 16,942,399 16,942,399 (+0.00%) 15,443,519 15,443,519 (+0.00%) 93,680 93,680 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188863 (keccak DA) state_commitment_update 16,942,399 16,942,399 (+0.00%) 15,443,519 15,443,519 (+0.00%) 93,680 93,680 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188937 (blobs DA) state_commitment_update 53,739,347 53,739,347 (+0.00%) 49,136,947 49,136,947 (+0.00%) 287,650 287,650 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188937 (keccak DA) state_commitment_update 53,739,347 53,739,347 (+0.00%) 49,136,947 49,136,947 (+0.00%) 287,650 287,650 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188945 (blobs DA) state_commitment_update 31,127,413 31,127,413 (+0.00%) 28,100,053 28,100,053 (+0.00%) 189,210 189,210 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188945 (keccak DA) state_commitment_update 31,127,413 31,127,413 (+0.00%) 28,100,053 28,100,053 (+0.00%) 189,210 189,210 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188950 (blobs DA) state_commitment_update 23,369,260 23,369,260 (+0.00%) 21,334,060 21,334,060 (+0.00%) 127,200 127,200 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188950 (keccak DA) state_commitment_update 23,373,478 23,373,478 (+0.00%) 21,338,278 21,338,278 (+0.00%) 127,200 127,200 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189014 (blobs DA) state_commitment_update 23,000,664 23,000,664 (+0.00%) 21,036,504 21,036,504 (+0.00%) 122,760 122,760 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189014 (keccak DA) state_commitment_update 23,000,666 23,000,666 (+0.00%) 21,036,506 21,036,506 (+0.00%) 122,760 122,760 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189128 (blobs DA) state_commitment_update 34,326,398 34,326,398 (+0.00%) 31,148,158 31,148,158 (+0.00%) 198,640 198,640 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189128 (keccak DA) state_commitment_update 34,326,398 34,326,398 (+0.00%) 31,148,158 31,148,158 (+0.00%) 198,640 198,640 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189151 (blobs DA) state_commitment_update 44,869,541 44,869,541 (+0.00%) 40,801,861 40,801,861 (+0.00%) 254,230 254,230 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189151 (keccak DA) state_commitment_update 44,869,541 44,869,541 (+0.00%) 40,801,861 40,801,861 (+0.00%) 254,230 254,230 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189153 (blobs DA) state_commitment_update 34,928,995 34,928,995 (+0.00%) 31,910,595 31,910,595 (+0.00%) 188,650 188,650 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189153 (keccak DA) state_commitment_update 34,928,995 34,928,995 (+0.00%) 31,910,595 31,910,595 (+0.00%) 188,650 188,650 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188855 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188862 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188863 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188937 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188945 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188950 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189014 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189128 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189151 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189153 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
Precompiles test-crate bench (synthetic workload, all labels)
Benchmark Symbol Base Eff Head Eff (%) Base Raw Head Raw (%) Base Blake Head Blake (%) Base Bigint Head Bigint (%) Base Keccak Head Keccak (%)
precompiles bn254_ecadd 53,340 53,340 (+0.00%) 47,888 47,888 (+0.00%) 0 0 (+0.00%) 1,363 1,363 (+0.00%) 0 0 (+0.00%)
precompiles bn254_ecmul 732,100 732,100 (+0.00%) 567,912 567,912 (+0.00%) 0 0 (+0.00%) 41,047 41,047 (+0.00%) 0 0 (+0.00%)
precompiles bn254_pairing 71,722,248 71,722,248 (+0.00%) 57,194,104 57,194,104 (+0.00%) 0 0 (+0.00%) 3,632,036 3,632,036 (+0.00%) 0 0 (+0.00%)
precompiles da_commitment 16,711 16,711 (+0.00%) 13,635 13,635 (+0.00%) 30 30 (+0.00%) 0 0 (+0.00%) 649 649 (+0.00%)
precompiles ecrecover 371,004 370,099 (-0.24%) 242,096 241,583 (-0.21%) 0 0 (+0.00%) 31,578 31,480 (-0.31%) 649 649 (+0.00%)
precompiles id 925 925 (+0.00%) 925 925 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles keccak 31,678 31,677 (-0.00%) 10,906 10,905 (-0.01%) 0 0 (+0.00%) 1 1 (+0.00%) 5,192 5,192 (+0.00%)
precompiles modexp 31,947,552 31,947,552 (+0.00%) 21,289,732 21,289,732 (+0.00%) 0 0 (+0.00%) 2,664,455 2,664,455 (+0.00%) 0 0 (+0.00%)
precompiles p256_verify 747,503 747,503 (+0.00%) 468,811 468,811 (+0.00%) 0 0 (+0.00%) 69,673 69,673 (+0.00%) 0 0 (+0.00%)
precompiles process_block 145,059,559 145,061,390 (+0.00%) 115,462,191 115,449,974 (-0.01%) 5,370 5,370 (+0.00%) 7,325,942 7,329,454 (+0.05%) 51,920 51,920 (+0.00%)
precompiles process_transaction 72,315,027 72,309,216 (-0.01%) 57,569,855 57,559,364 (-0.02%) 160 160 (+0.00%) 3,663,587 3,664,757 (+0.03%) 22,066 22,066 (+0.00%)
precompiles ripemd 8,015 8,015 (+0.00%) 8,015 8,015 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles run_tx_loop 144,574,390 144,576,003 (+0.00%) 115,093,810 115,081,375 (-0.01%) 180 180 (+0.00%) 7,325,942 7,329,454 (+0.05%) 43,483 43,483 (+0.00%)
precompiles sha256 13,319 13,319 (+0.00%) 13,319 13,319 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles state_commitment_update 183,037 183,236 (+0.11%) 143,357 143,556 (+0.14%) 2,480 2,480 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles system_init 49,856 49,856 (+0.00%) 49,856 49,856 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
FRI precompile bench (FriProofTx + sidecar + contract call)
Benchmark Symbol Base Eff Head Eff (%) Base Raw Head Raw (%) Base Blake Head Blake (%) Base Bigint Head Bigint (%) Base Keccak Head Keccak (%)
fri_precompile da_commitment 11,354 11,354 (+0.00%) 11,034 11,034 (+0.00%) 20 20 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
fri_precompile ecrecover 371,864 366,166 (-1.53%) 242,764 238,894 (-1.59%) 0 0 (+0.00%) 31,626 31,169 (-1.45%) 649 649 (+0.00%)
fri_precompile keccak 4,700 4,699 (-0.02%) 2,100 2,099 (-0.05%) 0 0 (+0.00%) 1 1 (+0.00%) 649 649 (+0.00%)
fri_precompile process_block 17,016,727 17,011,767 (-0.03%) 11,165,847 11,162,943 (-0.03%) 354,210 354,210 (+0.00%) 32,251 31,737 (-1.59%) 13,629 13,629 (+0.00%)
fri_precompile process_transaction 16,541,395 16,538,470 (-0.02%) 10,805,063 10,803,966 (-0.01%) 349,160 349,160 (+0.00%) 32,251 31,794 (-1.42%) 5,192 5,192 (+0.00%)
fri_precompile run_tx_loop 16,551,157 16,548,192 (-0.02%) 10,812,229 10,811,092 (-0.01%) 349,160 349,160 (+0.00%) 32,251 31,794 (-1.42%) 5,841 5,841 (+0.00%)
fri_precompile state_commitment_update 163,215 163,215 (+0.00%) 125,615 125,615 (+0.00%) 2,350 2,350 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
fri_precompile system_init 50,176 50,176 (+0.00%) 50,176 50,176 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)

Per-opcode

Per-opcode cycle diff

Opcode Count Med Cycles eff (%) Total Cycles eff (%) Med Cyc/Gas eff (%) Worst Cyc/Gas eff (%)
SHA3 49125 4,728 (+0.1%) 247,361,115 (+0.1%) 112.6 (+0.1%) 150.9
PUSH2 1676588 71 (-1.4%) 119,037,748 (-1.4%) 23.7 (-1.4%) 23.7 (-1.4%)
PUSH1 1586992 67 (+1.5%) 106,328,404 (+1.5%) 22.3 (+1.5%) 37.0
SLOAD 64715 1,258 (-0.2%) 103,047,399 (-0.1%) 8.4 (-0.2%) 22.8 (-0.1%)
MSTORE 419062 202 (+2.0%) 102,321,896 (+1.7%) 67.3 (+2.0%) 67.3 (+2.0%)
MLOAD 396315 181 (+2.3%) 71,791,689 (+2.3%) 60.3 (+2.3%) 60.3 (+2.3%)
SSTORE 17258 2,407 (-0.2%) 42,953,098 (-0.2%) 0.8 (-0.2%) 40.9 (-0.1%)
CALLDATALOAD 115629 237 (-1.7%) 29,041,442 (-1.6%) 79.0 (-1.7%) 103.7 (-1.3%)
PUSH20 114096 221 (-0.5%) 24,267,214 (-0.5%) 73.7 (-0.5%) 78.7 (-0.4%)
PUSH32 70114 296 (+0.3%) 19,894,436 (+0.4%) 98.7 (+0.3%) 101.3 (+0.3%)
LT 205877 90 (-1.1%) 18,367,916 (-1.1%) 30.0 (-1.1%) 30.0 (-1.1%)
EQ 215040 76 (+4.1%) 16,284,624 (+3.7%) 25.3 (+4.1%) 25.3 (+4.1%)
PUSH4 196444 77 (-51.0%) 15,126,188 (-49.1%) 25.7 (-51.0%) 25.7 (-53.0%)
CODECOPY 51097 289 (-0.7%) 14,850,895 (-0.7%) 48.2 (-0.7%) 48.3 (-0.7%)
DIV 50773 273 (-2.8%) 13,823,859 (-2.8%) 54.6 (-2.8%) 54.6 (-2.8%)
LOG3 6938 1,051 (+0.6%) 7,433,258 (+0.6%) 0.6 (+0.6%) 0.8 (+0.4%)
CALLDATACOPY 11796 352 (-0.3%) 7,177,871 (-0.2%) 20.2 (-0.7%) 48.2 (-0.7%)
ADDMOD 14942 372 (-2.4%) 5,583,359 (-2.3%) 46.5 (-2.4%) 98.9 (-1.1%)
EXTCODESIZE 2673 476 (+0.2%) 5,215,044 (+0.1%) 3.7 (+0.3%) 7.8 (+0.1%)
SLT 41867 97 (-1.0%) 3,951,263 (-1.0%) 32.3 (-1.0%) 32.7
SIGNEXTEND 14103 261 (-1.1%) 3,679,469 (-1.1%) 52.2 (-1.1%) 53.8 (-1.1%)
TSTORE 2650 956 (+0.2%) 2,671,660 (+0.2%) 9.6 (+0.2%) 29.0 (+0.1%)
PUSH8 29286 87 (-48.5%) 2,547,882 (-48.4%) 29.0 (-48.5%) 29.0 (-52.5%)
PUSH29 6639 306 (+0.3%) 2,020,908 (+0.3%) 102.0 (+0.3%) 102.0 (+0.3%)
TLOAD 3110 576 (-0.2%) 1,945,287 (-0.2%) 5.8 (-0.2%) 23.5 (-0.0%)
RETURNDATACOPY 5789 241 (-0.8%) 1,451,885 (-0.6%) 40.2 (-0.8%) 52.5 (-0.6%)
SDIV 4229 319 (+0.3%) 1,388,382 (+0.3%) 63.8 (+0.3%) 119.8
RETURN 12483 90 (-2.2%) 1,105,660 (-2.1%) n/a n/a
PUSH3 12487 77 (-47.3%) 961,499 (-48.1%) 25.7 (-47.3%) 25.7 (-51.3%)
LOG4 570 1,220 (+0.3%) 690,302 (+0.3%) 0.5 (+0.4%) 0.7 (+0.3%)
LOG1 709 866 (+0.6%) 629,362 (+0.6%) 0.6 (+0.6%) 1.1 (+0.5%)
MCOPY 1437 308 (+1.7%) 606,227 (+0.8%) 30.0 46.8 (+1.8%)
LOG2 551 946 (+0.9%) 541,863 (+0.8%) 0.6 (+0.8%) 0.9 (+0.7%)
PUSH21 1804 261 (+0.8%) 465,266 (+0.8%) 87.0 (+0.8%) 89.7 (+0.7%)
SAR 2385 182 (+1.1%) 436,721 (+0.8%) 60.7 (+1.1%) 95.7 (+0.3%)
CREATE2 14 7,135 (-0.1%) 337,385 (-0.0%) n/a n/a
PUSH31 1237 251 (+0.8%) 332,697 (+0.7%) 83.7 (+0.8%) 105.0 (+0.6%)
PUSH6 3491 86 (-45.9%) 300,226 (-45.9%) 28.7 (-45.9%) 28.7 (-50.9%)
MSTORE8 3116 94 (+5.6%) 292,904 (+5.6%) 31.3 (+5.6%) 31.3 (+5.6%)
PUSH5 2903 81 (-47.7%) 235,143 (-48.1%) 27.0 (-47.7%) 27.0 (-52.6%)
SELFBALANCE 564 356 (+3.2%) 204,439 (+3.1%) 71.2 (+3.2%) 133.0 (+1.7%)
PUSH7 2266 89 (-51.1%) 201,674 (-48.6%) 29.7 (-51.1%) 29.7 (-51.1%)
SMOD 544 290 (-2.4%) 162,425 (-2.3%) 58.0 (-2.4%) 63.0 (-2.2%)
PUSH26 304 276 (+0.7%) 81,582 (+0.8%) 92.0 (+0.7%) 98.0 (+0.7%)
EXTCODEHASH 43 550 (+0.2%) 73,007 (+0.1%) 4.7 (+0.2%) 6.8 (+0.1%)
EXTCODECOPY 20 1,446 (+0.8%) 71,469 (+0.3%) 8.9 (+1.2%) 41.2 (+0.3%)
ORIGIN 976 70 (-1.4%) 68,320 (-1.4%) 35.0 (-1.4%) 35.0 (-1.4%)
CHAINID 409 63 (-1.6%) 25,767 (-1.6%) 31.5 (-1.6%) 31.5 (-1.6%)
PUSH30 75 292 (-0.3%) 21,528 (-0.3%) 97.3 (-0.3%) 103.3 (-0.3%)
LOG0 26 726 (+0.4%) 19,278 (+0.4%) 0.9 (+0.4%) 1.2 (+0.4%)
REVERT 215 91 (-1.1%) 18,405 (-0.9%) 66.7 (-0.5%) 66.7 (-0.5%)
PUSH25 71 273 (+0.4%) 18,359 (+0.4%) 91.0 (+0.4%) 93.7 (+0.4%)
PUSH27 38 282 (+0.7%) 10,262 (+0.7%) 94.0 (+0.7%) 100.0 (+0.7%)
CREATE 2 3,357 (+0.1%) 6,714 (+0.1%) n/a n/a
SELFDESTRUCT 2 2,543 (+0.1%) 5,087 (+0.1%) 0.5 (+0.1%) 0.5 (+0.1%)
BLOCKHASH 14 208 (-1.4%) 2,912 (-1.4%) 10.4 (-1.4%) 10.4 (-1.4%)
BLOBHASH 11 175 (-0.6%) 1,723 (-0.6%) 58.3 (-0.6%) 58.3 (-0.6%)
GASPRICE 19 75 (-1.3%) 1,425 (-1.3%) 37.5 (-1.3%) 37.5 (-1.3%)
BLOBBASEFEE 2 78 (+1.3%) 156 (+1.3%) 39.0 (+1.3%) 39.0 (+1.3%)

Per-precompile

Per-precompile per-execution ratios (head)
cycles = effective (raw + Blake×16 + BigInt×4 + Keccak×4)
precompile                count    med c/g    p95 c/g    p99 c/g    max c/g    med n/g    p95 n/g    p99 n/g    max n/g
------------------------------------------------------------------------------------------------------------------------
keccak                    42872      111.9      126.8      209.3     4296.0      478.8      478.8      626.8      681.4
modexp                     2501       63.3       63.5      187.0     2877.1      500.0      500.0      500.0     4814.0
point_eval                   11     1023.6     1029.1     1029.1     1029.1     1262.1     1262.1     1262.1     1262.1
bls12_g1add                  12      895.0      896.6      896.6      896.6        0.0        0.0        0.0        0.0
blake2f                       2      803.7      803.7      803.7      803.7        0.0        0.0        0.0        0.0
bls12_pairing_check           4      217.7      427.5      427.5      427.5        0.0        0.0        0.0        0.0
ecadd                       617      352.1      360.8      364.2      368.1      350.7      350.7      350.7      350.7
bls12_g1msm                  12      157.9      318.7      318.7      318.7        0.0        0.0        0.0        0.0
ecpairing                    40      169.1      186.3      186.3      186.3      398.2      428.6      428.6      428.6
sha256                       28       96.4      143.6      143.6      143.6      104.2      148.9      148.9      148.9
ecmul                       597      120.9      125.3      126.5      128.6      127.3      127.3      127.3      127.3
ecrecover                   713      119.7      121.9      123.2      123.6      174.0      174.0      174.0      174.0
p256_verify                  22      107.7      108.3      108.4      108.4      113.6      113.6      113.6      113.6
bls12_g2msm                   2       88.4       88.4       88.4       88.4        0.0        0.0        0.0        0.0
identity                    292       29.2       41.7       44.4       50.8       40.8       59.0       62.8       72.2
bls12_g2add                   2       46.0       46.0       46.0       46.0        0.0        0.0        0.0        0.0
ripemd160                     4        4.4        7.4        7.4        7.4        8.1       13.1       13.1       13.1

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