Skip to content

perf(storage-overlay): register proof cursor metrics on first multiproof - #30

Closed
BrianBland wants to merge 1 commit into
releases/v2.8.0from
brianbland/v2.8.0-lazy-proof-metrics
Closed

BrianBland wants to merge 1 commit into
releases/v2.8.0from
brianbland/v2.8.0-lazy-proof-metrics

Conversation

@BrianBland

Copy link
Copy Markdown

Fixes a v2.8.0 regression in BlockchainProvider::history_by_*, reported by base/base#6148's storage provider benchmark (historical_provider/open +36%, the *_before_change benches +17–22%).

Bisected to paradigmxyz#27945. OverlayStateProvider::new/new_ref now build a ProofCursorMetrics::default(), which registers 4 groups of trie and hashed cursor histograms with the global recorder on every provider open, even when the provider never computes a multiproof. This change keeps those handles as Option on the provider: factory-built providers still share the factory's handles, and standalone providers register them on their first multiproof.

Instructions retired per op, with the base/base historical_provider fixture (macOS time -l, (N=420k − N=20k)/400k, median of 3):

op base-v2.7.0.2 v2.8.0 v2.8.0 + this
open/v1 11,561 23,265 13,567
open/v2 11,362 23,342 13,556
account_before_change/v2 48,422 60,407 50,620
storage_before_change/v2 48,861 60,840 51,443

The remaining ~2k instructions/op spreads across many v2.7.0..v2.8.0 commits and has no single cause.

Tests: cargo test -p reth-storage-overlay --all-features (52 passed); clippy with -D warnings; fmt --check.

OverlayStateProvider::new and new_ref registered four groups of trie and
hashed cursor metric handles with the global recorder on every call, so
every BlockchainProvider::history_by_* call paid for them even when no
multiproof was computed. Defer registration to the first multiproof for
providers built outside a factory; factory providers keep sharing the
factory's handles.

Co-authored-by: Toshi <toshi-noreply@coinbase.com>
BrianBland added a commit that referenced this pull request Oct 21, 2026
BrianBland added a commit to base/base that referenced this pull request Oct 21, 2026
Carry base/reth#30, which stops OverlayStateProvider from registering
proof cursor metrics on every history_by_* call. Reth v2.8.0 (#27945)
roughly doubled the instructions per historical provider open, the
regression the storage provider benchmark flagged.

Co-authored-by: Toshi <toshi-noreply@coinbase.com>
BrianBland added a commit to base/base that referenced this pull request Oct 21, 2026
Drop base/reth#30 for now. The extra per-open cost from reth#27945 is
about 0.4 µs per historical state provider open and does not touch the
engine or latest-state paths, so carrying a fork patch for it is not
worth the cost.

Co-authored-by: Toshi <toshi-noreply@coinbase.com>
@BrianBland

Copy link
Copy Markdown
Author

Not carrying this in the fork for now: ~0.4 µs per historical provider open, and the engine and latest-state paths are unaffected. base/base is back on base-v2.8.0.1. The fix will go to paradigmxyz/reth instead. The branch stays for reference; tag base-v2.8.0.2 still exists but nothing pins it.

@BrianBland BrianBland closed this Oct 21, 2026
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