mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 19:00:46 +00:00
core/vm/runtime/testdata: swapped out loop benchmarks for block sync benchmarks
This commit is contained in:
parent
fd9be88ed8
commit
76b49515e0
2 changed files with 24 additions and 17 deletions
8
core/vm/runtime/testdata/evm-bench/README.md
vendored
8
core/vm/runtime/testdata/evm-bench/README.md
vendored
|
|
@ -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
|
||||
|
||||
|
|
|
|||
33
core/vm/runtime/testdata/evm-bench/compare.sh
vendored
33
core/vm/runtime/testdata/evm-bench/compare.sh
vendored
|
|
@ -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 <dir> <outfile>
|
||||
local dir="$1" out="$2" entry pat n
|
||||
local dir="$1" out="$2" entry pkg pat n
|
||||
for entry in "${BENCHES[@]}"; do
|
||||
pat="${entry%:*}"
|
||||
pkg="${entry%%:*}"
|
||||
pat="${entry#*:}"; pat="${pat%:*}"
|
||||
n="${entry##*:}"
|
||||
( cd "$dir" && go test ./core/vm/runtime/ -run '^$' -bench "$pat" -benchmem -benchtime "$n" -count="$COUNT" ) | tee -a "$out"
|
||||
( cd "$dir" && go test "$pkg" -run '^$' -bench "$pat" -benchmem -benchtime "$n" -count="$COUNT" ) | tee -a "$out"
|
||||
done
|
||||
}
|
||||
|
||||
|
|
@ -52,6 +52,7 @@ echo "==> baseline: $BASEREF (throwaway worktree, suite copied in)"
|
|||
WT="$(mktemp -d)"
|
||||
git worktree add --quiet --detach "$WT" "$BASEREF"
|
||||
cp core/vm/runtime/evm_bench_test.go "$WT/core/vm/runtime/"
|
||||
cp core/bench_test.go "$WT/core/bench_test.go"
|
||||
mkdir -p "$WT/core/vm/runtime/testdata"
|
||||
cp core/vm/runtime/testdata/*.hex "$WT/core/vm/runtime/testdata/"
|
||||
run_suite "$WT" "$OLD"
|
||||
|
|
|
|||
Loading…
Reference in a new issue