Skip to content

Conversation

@pdrobnjak
Copy link
Contributor

Summary

  • Avoid force-materializing stores when creating child CacheMultiStore instances

Stack

4/13 — depends on perf/skip-db-cachekv-child-cms

🤖 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:14 PM

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.90%. Comparing base (8a05681) to head (4c13c26).

Additional details and impacted files

Impacted file tree graph

@@                         Coverage Diff                         @@
##           perf/skip-db-cachekv-child-cms    #2839       +/-   ##
===================================================================
+ Coverage                           56.80%   58.90%    +2.10%     
===================================================================
  Files                                2070      402     -1668     
  Lines                              168450    36953   -131497     
===================================================================
- Hits                                95688    21769    -73919     
+ Misses                              64269    12954    -51315     
+ Partials                             8493     2230     -6263     
Flag Coverage Δ
sei-chain ?
sei-cosmos ?
sei-db 68.72% <ø> (ø)
sei-tendermint 58.78% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1707 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.

Comment on lines +118 to +122
for k, v := range cms.storeParents {
if _, exists := storeParents[k]; !exists {
storeParents[k] = v
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
…tion

Remove force-materialization of all lazy parent stores when creating
child CacheMultiStore instances. Instead, merge both materialized
stores and lazy storeParents into the child's storeParents map.

This is safe because:
- Materialized stores: child wraps them, Write() propagates correctly
- Lazy stores: parent has no cachekv yet, so no stale cache. Child
  wraps the raw parent directly, and parent's eventual cachekv will
  read through and see child's writes.

Key changes:
- Replace Lock with RLock (no parent mutations needed)
- Skip ensureStoreLocked/ensureGigaStoreLocked loops
- Merge both stores and storeParents from parent into child
- Pre-size stores/gigaStores maps to avoid growth in SetKVStores

Expected savings: ~13 GB allocs/30s from cachekv.NewStore calls that
were either immediately replaced by OCC SetKVStores or never accessed
by nested EVM Snapshots (which touch 3-5 of ~20 stores per level).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pdrobnjak pdrobnjak force-pushed the perf/skip-db-cachekv-child-cms branch from 8b30fb3 to 8a05681 Compare February 11, 2026 13:19
@pdrobnjak pdrobnjak force-pushed the perf/skip-force-materialize-child-cms branch from 7ab465a to 4c13c26 Compare February 11, 2026 13:19
@pdrobnjak pdrobnjak marked this pull request as draft February 11, 2026 14:13
@pdrobnjak pdrobnjak self-assigned this Feb 11, 2026
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