Skip to content

EVM: inline getOp for execution speedup #1043

Open
elopez wants to merge 2 commits intomainfrom
perf
Open

EVM: inline getOp for execution speedup #1043
elopez wants to merge 2 commits intomainfrom
perf

Conversation

@elopez
Copy link
Collaborator

@elopez elopez commented Mar 7, 2026

Description

This PR inlines getOp. I see a measurable speed improvement with this change locally. The optimization was suggested by Claude Code.

Checklist

  • tested locally
  • added automated tests
  • updated the docs
  • updated the changelog

elopez added 2 commits March 7, 2026 01:58
Adding {-# INLINE getOp #-} enables GHC's case-of-case transformation,
eliminating the intermediate GenericOp constructor allocation in opcode
dispatch. This also lets GHC sink expensive thunks (contract lookups,
fee schedule fields) into only the opcode branches that use them.
Add doBenchmark = true to shellFor so that benchmark dependencies
(tasty-bench) are available in nix develop without cabal update.
Replace deprecated testTarget with testTargets.
Copy link
Collaborator

@msooseth msooseth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I'm OK with such optimizations in case they benefit Echidna speed. Symbolic execution speed is mostly governed by SMT solver speed, so as long as this works for you, I'm good with it. However, it'd be nice to post a bench measurement test to the text of the PR so when we wanna understand things in the future, we can look it up.

DAPP_SOLC = "${solc}/bin/solc";
}))
[
(hlib.compose.overrideCabal (old: { testTarget = "test"; }))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related? Should it be here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, but I've been getting a deprecation warning about that for a while now, so I just fixed that in fb3bfe4 while I was there.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I... really don't understand nix. What is this thing doing? I guess it defines that the test is and then eventually it will be run? Are you sure this is not accidentally disabling tests? Sorry, this is really arcane stuff.

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.

2 participants