Skip to content

perf: reduce allocations in captureState hot path#4348

Open
reallesee wants to merge 2 commits intoOffchainLabs:masterfrom
reallesee:perf/reduce-allocs-tracing
Open

perf: reduce allocations in captureState hot path#4348
reallesee wants to merge 2 commits intoOffchainLabs:masterfrom
reallesee:perf/reduce-allocs-tracing

Conversation

@reallesee
Copy link

Preallocate stack slice and avoid redundant uint256.Int allocations in captureState.
This function is called per opcode during tracing, so reducing allocs has measurable impact.

Benchmark shows ~2.7x speedup and 75% fewer allocations (4 -> 1 per call).

Also reuse zeroPad buffer in MerkleAccumulator.Root() instead of allocating in loop.

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