From 76b49515e070b7c78426cb2cb7fad52438799633 Mon Sep 17 00:00:00 2001 From: jonny rhea <5555162+jrhea@users.noreply.github.com> Date: Thu, 11 Jun 2026 15:49:34 -0500 Subject: [PATCH] core/vm/runtime/testdata: swapped out loop benchmarks for block sync benchmarks --- core/vm/runtime/testdata/evm-bench/README.md | 8 ++++- core/vm/runtime/testdata/evm-bench/compare.sh | 33 ++++++++++--------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/core/vm/runtime/testdata/evm-bench/README.md b/core/vm/runtime/testdata/evm-bench/README.md index fccea2ce87..128d1faccf 100644 --- a/core/vm/runtime/testdata/evm-bench/README.md +++ b/core/vm/runtime/testdata/evm-bench/README.md @@ -32,7 +32,13 @@ core/vm/runtime/testdata/evm-bench/compare.sh HEAD~1 8 # vs another ref, count `compare.sh` benches the current working tree and a baseline ref (checked out in a throwaway worktree with this suite copied in, so it works whether or not the -interpreter change is committed) and runs `benchstat`. +interpreter change is committed) and runs `benchstat`. Besides the contract +workloads it runs both `BenchmarkInsertChain_evmWorkload` variants from +`core/bench_test.go`, which push blocks carrying these contracts through the +full block import path (state in memory and on disk) and report Mgas/s, as a +local stand-in for sync throughput. The synthetic dispatch loops (`BenchmarkSimpleLoop/loop*` in +`core/vm/runtime/runtime_test.go`) are not part of the A/B suite, but can +still be run manually to isolate dispatch overhead. ## Regenerating the bytecode diff --git a/core/vm/runtime/testdata/evm-bench/compare.sh b/core/vm/runtime/testdata/evm-bench/compare.sh index 624120bf6e..aaf4eb9282 100755 --- a/core/vm/runtime/testdata/evm-bench/compare.sh +++ b/core/vm/runtime/testdata/evm-bench/compare.sh @@ -1,8 +1,9 @@ #!/usr/bin/env bash # A/B benchmark of the codegen interpreter vs a baseline: runs the evm-bench -# contract workloads (core/vm/runtime/evm_bench_test.go) plus the synthetic -# dispatch loops (BenchmarkSimpleLoop/loop*) on the current working tree and on -# a baseline ref, then benchstats them. +# contract workloads (core/vm/runtime/evm_bench_test.go) plus the block import +# benchmark (core/bench_test.go, BenchmarkInsertChain_evmWorkload, a local +# stand-in for sync throughput) on the current working tree and on a baseline +# ref, then benchstats them. # # The baseline is checked out in a throwaway git worktree and this suite is # copied into it, so the comparison works whether or not the interpreter changes @@ -22,26 +23,25 @@ COUNT="${2:-10}" # so one-time costs (map growth, pool warmup) amortize over a different N and # B/op picks up phantom deltas, and GC pacing can do the same to sec/op. Fixed # N makes both sides do identical work. The counts target roughly one second -# per count on a fast box. Each entry is pattern:iterations, and SimpleLoop -# needs the /^loop element to select only its loop variants (go test splits -# -bench on / and benchmarks without sub-benchmarks cannot match a two-element -# pattern, so the loops run as their own invocation anyway). +# per count on a fast box. Each entry is package:pattern:iterations. BENCHES=( - '^BenchmarkSnailtracer$:20x' - '^BenchmarkTenThousandHashes$:100x' - '^BenchmarkERC20Transfer$:100x' - '^BenchmarkERC20Mint$:150x' - '^BenchmarkERC20ApprovalTransfer$:120x' - '^BenchmarkSimpleLoop$/^loop:7x' + './core/vm/runtime/:^BenchmarkSnailtracer$:20x' + './core/vm/runtime/:^BenchmarkTenThousandHashes$:100x' + './core/vm/runtime/:^BenchmarkERC20Transfer$:100x' + './core/vm/runtime/:^BenchmarkERC20Mint$:150x' + './core/vm/runtime/:^BenchmarkERC20ApprovalTransfer$:120x' + './core/:^BenchmarkInsertChain_evmWorkload_memdb$:10x' + './core/:^BenchmarkInsertChain_evmWorkload_diskdb$:10x' ) NEW="$(mktemp)"; OLD="$(mktemp)" run_suite() { # run_suite