Skip to content

cmd/evm: speed up TestEvmRun - #23120

Draft
lupin012 wants to merge 2 commits into
mainfrom
lupin012/speedup_test_evm_run
Draft

cmd/evm: speed up TestEvmRun#23120
lupin012 wants to merge 2 commits into
mainfrom
lupin012/speedup_test_evm_run

Conversation

@lupin012

@lupin012 lupin012 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Closes #15153

Problem: TestEvmRun took ~2.9s. Two of its four sub-cases pass --bench, which calls testing.Benchmark: it loops until it accumulates ~1s of measured time (the default benchtime), no matter how trivial the executed bytecode is. The default cannot be overridden from the command line, because the re-exec'd child parses flags with urfave/cli, not with the testing package.

Two changes (test code only):

  1. The re-exec handler in TestMain sets -test.benchtime from the EVM_TEST_BENCHTIME env variable. It is opt-in: without the variable the 1s default stays. TestEvmRun passes 1x (a single measured iteration, deterministic) per child via a new optional Env field on cmdtest.TestCmd. 2.94s → 0.80s.
  2. The four sub-cases now run as named parallel subtests, so the child processes overlap. 0.80s → 0.22s (stable across 10 runs, race detector clean, full cmd/evm package still passes).

Question for reviewers: at 0.22s the test is well below the 500ms threshold that motivated its exclusion from short mode in #15144. Can we also remove the testing.Short() skip and bring it back into the short suite?

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.

Investigate why TestEvmRun is slow

1 participant