Skip to content

feat: EVM execution opcode level optimization#77

Merged
owen-reorg merged 7 commits intobnb-chain:developfrom
sunny2022da:alpha-v03
Apr 9, 2024
Merged

feat: EVM execution opcode level optimization#77
owen-reorg merged 7 commits intobnb-chain:developfrom
sunny2022da:alpha-v03

Conversation

@sunny2022da
Copy link
Copy Markdown
Collaborator

@sunny2022da sunny2022da commented Mar 28, 2024

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

several optimizations included:
- opcode fusion
- jumpdest calculation optimization
- SHA caching in interpreter

Co-authored-by: redhdx <lredhdx@gmail.com>
@github-actions github-actions bot requested review from redhdx and welkin22 March 28, 2024 02:29
@owen-reorg owen-reorg requested review from a user and owen-reorg March 28, 2024 06:59
@sunny2022da sunny2022da force-pushed the alpha-v03 branch 2 times, most recently from e71fbc0 to f315695 Compare March 28, 2024 07:47
@sunny2022da
Copy link
Copy Markdown
Collaborator Author

UT test fails has been fixed. The current 2 failed cases seems not related with this PR.

  • TestPrecompiledPointEvaluation: seems related with ZK
  • TestExecutionSpec: seems related with gas but it fails too without this PR.

FYI

Switch interpreter jump table at runtime to avoid mismatch of optimized
opcode and the spec.
@owen-reorg
Copy link
Copy Markdown
Contributor

Please do refactor a little bit to avoid unnecessary changes, including format, new lines, changes with no effect, comments, etc. It will reduce potential overhead to resolve conflicts in further merge.

@owen-reorg owen-reorg merged commit d5ba7d9 into bnb-chain:develop Apr 9, 2024
owen-reorg pushed a commit to owen-reorg/op-geth that referenced this pull request Apr 25, 2024
…imate

implement more accurate & predicable priority fee suggestion algorithm for chains like Optimism
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.

3 participants