Skip to content

feat: EVM execution opcode level optimization #3144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

annielz
Copy link

@annielz annielz commented Jun 4, 2025

This pr copies the optimizations from opbnb: bnb-chain/op-geth#77

several optimizations included:

opcode fusion
jumpdest calculation optimization
SHA caching in interpreter
we observed ~1.2-1.5x speedup in execution time of opbnb mainnet when syncing block at hight ~11m

Description
This PR introduce several optimizations in EVM execution engine, mainly 3 points:
opcode fusion: Combine several hottest opcodes into one super instruction to reduce strength
jumpdest calculation optimizations: reduce the unnecessary jumpdest calculation every time a call happened by leverage caching.
SHA cacheing in interpreter: optimized the SHA opcode to use hash cache that already implemented in geth.

Rationale
To speed up the execution time of contracts and hence enhance the performance.

Example
N/A

Changes
Notable changes:

opcode fusion
jumpdest calculation optimization
SHA caching in interpreter

@annielz annielz changed the title feat: opcode optimization feat: EVM execution opcode level optimization Jun 4, 2025
@constwz constwz force-pushed the feat-opcode-optimization branch from c5fe1f5 to a925a4b Compare June 5, 2025 02:33
@annielz annielz force-pushed the feat-opcode-optimization branch 2 times, most recently from 3aac3d7 to eff1f45 Compare June 23, 2025 08:41
fix: evmByteCode

fix: ut

fix: ut

fix: lint

feat: add new config to gen_config.go

feat: commit with all logs

feat: clean unused logs

feat: comment unused log

feat: modify log

feat: modify log

feat: modify log

fix: log

feat: more logs

feat: calculate rate of optimized code

feat: add optimized check in all superinstructions

feat: check for first occurance of INVALID bytecode

feat: check and return when first encounter invalid

feat: restore length

feat: clean unused log
@annielz annielz force-pushed the feat-opcode-optimization branch from eff1f45 to 3beb764 Compare June 23, 2025 09:09
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.

1 participant