perf(evm): skip redundant initial Snapshot in OCC executor path#2819
Merged
pdrobnjak merged 1 commit intoperf/lazy-cachemultistorefrom Feb 11, 2026
Merged
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
4 tasks
f95aa5e to
b620ffb
Compare
a3a9cf5 to
2286d83
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## perf/lazy-cachemultistore #2819 +/- ##
=============================================================
+ Coverage 56.77% 56.78% +0.01%
=============================================================
Files 2070 2070
Lines 168336 168351 +15
=============================================================
+ Hits 95572 95600 +28
+ Misses 64280 64259 -21
- Partials 8484 8492 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
b620ffb to
13f343e
Compare
e91f6e4 to
ae6bbe8
Compare
In the OCC executor path, each EVM transaction creates 3 CacheMultiStore layers: 1. prepareTask: CMS with VersionIndexedStore wrappers (OCC isolation) 2. NewDBImpl: Snapshot() creates CMS wrapping #1 (GetCommittedState baseline) 3. Prepare: Snapshot() creates CMS wrapping #2 (EVM revert support) Layer #2 is redundant because no state changes occur between NewDBImpl and Prepare (called by go-ethereum's StateTransition.Execute). Prepare's Snapshot provides the same GetCommittedState baseline. Add NewDBImplWithoutSnapshot() that skips the initial Snapshot, used only in the OCC hot path (app.go executeEVMTxWithGigaExecutor). The original NewDBImpl is preserved for all other callers (tests, RPC, ante handlers) that may write state before the first explicit Snapshot. Also add defensive guards on GetCommittedState and flushEvents for the case where snapshottedCtxs is empty. Results (M4 Max benchmark, diff vs previous): - DBImpl.Snapshot alloc: -9.8 GB - cachemulti.newStoreWithoutGiga: -10.5 GB - Total alloc_space: 457 GB → 313 GB (-31%) - Idle CPU (usleep+kevent): 42.9s → 30.1s (-30%, workers busier) - TPS steady-state: 7,200-8,600 (median ~8,000) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
de7b59d to
f1c3021
Compare
ae6bbe8 to
08c4efe
Compare
Base automatically changed from
perf/cache-gaskv-context
to
perf/lazy-cachemultistore
February 11, 2026 13:19
Contributor
Author
|
This PR was auto-merged by GitHub during a stack reorder (branch force-push made head appear merged into base). No code was actually merged to main. This PR has been superseded — see the restacked PR chain starting at #2849. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Snapshot()call inNewDBImplfor the OCC executor hot pathNewDBImplWithoutSnapshot()used only byexecuteEVMTxWithGigaExecutorNewDBImplpreserved for all other callers (tests, RPC, ante handlers)Problem
In the OCC executor path, each EVM transaction creates 3 CacheMultiStore layers:
CMS2 exists to provide a
GetCommittedStatebaseline viasnapshottedCtxs[0]. But no state changes occur betweenNewDBImplandPrepare(called by go-ethereum'sStateTransition.Execute), so Prepare's Snapshot provides the same baseline.Profiling after #2808 (30s, M4 Max, 1000 EVM transfers/block):
DBImpl.Snapshotalloc_space (cum)cachemulti.newStoreWithoutGigaalloc_spaceChanges
giga/deps/xevm/state/statedb.go: AddNewDBImplWithoutSnapshot()constructor + defensive guard onflushEventsgiga/deps/xevm/state/state.go: Defensive guard onGetCommittedStatefor emptysnapshottedCtxsapp/app.go: Hot path usesNewDBImplWithoutSnapshotBenchmark Results (M4 Max, 1000 EVM transfers/block, 30s profile)
DBImpl.Snapshotalloc_spacecachemulti.newStoreWithoutGigaallocnewCacheMultiStoreFromCMSalloc (cum)memclrNoHeapPointersCPUNote: TPS is flat despite -31% alloc because freed CPU shifts from idle to allocation overhead (
memclrNoHeapPointers). Workers complete faster but the GC/allocator remains the bottleneck.pprof -alloc_space -diff_basehighlightspprof -top -diff_basehighlights (CPU)Why safe
core.ApplyMessage→StateTransition.Executealways callsPrepare()→Snapshot()before any EVM state reads/writesGetCommittedStateusessnapshottedCtxs[0]which is set byPrepare'sSnapshot()— same committed state baselineNewDBImplcallers (tests, RPC, ante) keep the initialSnapshot()for isolationsnapshottedCtxsis emptyTest plan
go test ./giga/deps/xevm/state/... -count=1— pass (including TestSnapshot)go test ./giga/tests/... -count=1— pass (all 14 giga tests)gofmt -s -wclean🤖 Generated with Claude Code