Skip to content

perf(evm): skip redundant initial Snapshot in OCC executor path#2854

Draft
pdrobnjak wants to merge 1 commit intomainfrom
perf/skip-redundant-snapshot
Draft

perf(evm): skip redundant initial Snapshot in OCC executor path#2854
pdrobnjak wants to merge 1 commit intomainfrom
perf/skip-redundant-snapshot

Conversation

@pdrobnjak
Copy link
Contributor

Summary

  • Skip the redundant initial Snapshot() call in the OCC executor path

Stack

7/19 — depends on perf/cache-gaskv-context (replaces auto-closed #2819)

🤖 Generated with Claude Code

@github-actions
Copy link

github-actions bot commented Feb 11, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedFeb 11, 2026, 2:03 PM

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>
@pdrobnjak pdrobnjak force-pushed the perf/cache-gaskv-context branch from f1c3021 to a4c49dc Compare February 11, 2026 13:34
@pdrobnjak pdrobnjak force-pushed the perf/skip-redundant-snapshot branch from 08c4efe to 8d2dc33 Compare February 11, 2026 13:34
@pdrobnjak pdrobnjak changed the base branch from perf/cache-gaskv-context to main February 11, 2026 13:34
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.21%. Comparing base (21e991f) to head (8d2dc33).

Files with missing lines Patch % Lines
giga/deps/xevm/state/state.go 0.00% 1 Missing and 1 partial ⚠️
giga/deps/xevm/state/statedb.go 84.61% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2854      +/-   ##
==========================================
+ Coverage   46.28%   52.21%   +5.93%     
==========================================
  Files        2005     2027      +22     
  Lines      163018   160471    -2547     
==========================================
+ Hits        75449    83792    +8343     
+ Misses      81047    68765   -12282     
- Partials     6522     7914    +1392     
Flag Coverage Δ
sei-chain 40.88% <75.00%> (-0.04%) ⬇️
sei-cosmos ?
sei-db 68.72% <ø> (ø)
sei-tendermint 58.83% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
app/app.go 65.78% <100.00%> (-0.08%) ⬇️
giga/deps/xevm/state/state.go 95.12% <0.00%> (-1.58%) ⬇️
giga/deps/xevm/state/statedb.go 43.82% <84.61%> (+3.55%) ⬆️

... and 762 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pdrobnjak pdrobnjak self-assigned this Feb 11, 2026
@pdrobnjak pdrobnjak marked this pull request as draft February 11, 2026 14:04
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.

1 participant