Skip to content

[WIP] Perf/vm optimizations#18919

Draft
Giulio2002 wants to merge 3 commits intomainfrom
perf/vm-optimizations
Draft

[WIP] Perf/vm optimizations#18919
Giulio2002 wants to merge 3 commits intomainfrom
perf/vm-optimizations

Conversation

@Giulio2002
Copy link
Contributor

No description provided.

Giulio2002 and others added 3 commits February 2, 2026 02:47
…hains

Add early return for zero-value transfers to avoid unnecessary state
operations. The check is skipped for Aura chains (Gnosis) which need
zero-value transfers to touch accounts for state root compatibility.

This restores performance that was regressed by PR #18846 which removed
the zero-check from SubBalance() for Gnosis compatibility.

Benchmark improvement (non-Aura chains):
- call-identity: 176ms -> 128ms (27% faster)
- call-EOA: 194ms -> 144ms (26% faster)
- Allocations reduced from 1.3M+ to near zero

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move traceGas function from closure inside Run() to package-level function
to avoid potential closure overhead in the hot interpreter loop.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace new(uint256.Int) heap allocations with stack-allocated variables
in frequently called opcode functions. This eliminates unnecessary heap
allocations in the interpreter hot path.

Optimized functions:
- opPush1, opPush2, makePush
- opGas, opPc, opMsize, opGasLimit
- opAddress, opOrigin, opCaller
- opCoinbase, opTimestamp, opNumber, opDifficulty
- opCallDataSize, opReturnDataSize, opCodeSize

Benchmark improvements vs main:
- loop-100M: 237ms -> 161ms (32% faster)
- call-identity-100M: 157ms -> 132ms (16% faster)
- RETURN/1000000: 312ms -> 43ms (86% faster)
- SWAP1/10k: 55ms -> 44ms (20% faster, 5 fewer allocs)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@AskAlexSharov
Copy link
Collaborator

@Giulio2002 red tests

@Giulio2002 Giulio2002 marked this pull request as draft February 2, 2026 14:57
@Giulio2002
Copy link
Contributor Author

i know WIP. for a reason :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants