feat(benchmarking): Optimize IteratingBytecode#2184
Merged
fselmo merged 5 commits intoethereum:forks/amsterdamfrom Feb 11, 2026
Merged
feat(benchmarking): Optimize IteratingBytecode#2184fselmo merged 5 commits intoethereum:forks/amsterdamfrom
IteratingBytecode#2184fselmo merged 5 commits intoethereum:forks/amsterdamfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #2184 +/- ##
================================================
Coverage 86.07% 86.07%
================================================
Files 599 599
Lines 39472 39472
Branches 3780 3780
================================================
Hits 33977 33977
Misses 4862 4862
Partials 633 633
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fselmo
approved these changes
Feb 11, 2026
4 tasks
RazorClient
pushed a commit
to RazorClient/execution-specs
that referenced
this pull request
Feb 11, 2026
…thereum#2184) * Separate first three secp256r1 vector topic files * Extract another two topic files * Three more topic separations * Generalize infinity point topic, add test cases * Additional grouping * More sorting * Final test cases sorted * Delete original file * Apply suggestions from code review Co-authored-by: spencer <spencer.taylor-brown@ethereum.org> * Small fixes * Linting --------- Co-authored-by: spencer <spencer.taylor-brown@ethereum.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🗒️ Description
Focuses on optimizing the test generation in benchmarking, particularly test
tests/benchmark/compute/instruction/test_account_query.py::test_account_query[fork_Osaka-blockchain_test_engine_x-value_sent_0-code_size_256-mem_size_32-access_warm_True-opcode_EXTCODECOPY-benchmark-gas-value_150M], which is the longest running test excluding t8n executions at 169.82s, by doing the following optimizations:Cache Bytecode.keccak256
This method is heavily used by tests that compute the
CREATE2address to determine where a contract is going to be deployed.This optimization simply caches the result of keccak inside a
Bytecodeobject, and also makescompute_create2_addressaware of the input potentially being aBytecodeto avoid converting toBytesand wasting the optimization.After optimization: 169.82s -> 60.18s
Cache Bytecode.gas_cost(fork)/Bytecode.refund(fork)
Another simple cache to return the previous known value when the functions are called with the same parameters. The cache holds a single item because we rarely call this function with multiple forks in a single instance.
After optimization: 60.18s -> 56.55s
CustomSizedContractFactory.created_contract_addressCachingCreates a dictionary cache inside of
CustomSizedContractFactoryto hold the calculated addresses of the different salts. The cache is not evicted, but it should be ok since the instance ofCustomSizedContractFactorynever makes it out of the test function, and the hash sizes are relatively small.After optimization: 56.55s -> 22.54s
Access List Caching in
test_account_queryFinally, test
tests/benchmark/compute/instruction/test_account_query.py::test_account_queryuses a dynamic access list to warm up addresses of the contracts to be used during the attack, and this is done using a callback, which is repeatedly called many times due to the binary search performed byIteratingBytecodeto find the max amount of iterations given the gas limit of the test.After optimization: 22.54s -> 9.31s
🔗 Related Issues or PRs
N/A.
✅ Checklist
toxchecks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx tox -e statictype(scope):.mkdocs servelocally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_frommarker.Cute Animal Picture