pack: prefetch what insert and eviction are about to read - #11435
Open
mmcgee-jump wants to merge 1 commit into
Open
pack: prefetch what insert and eviction are about to read#11435mmcgee-jump wants to merge 1 commit into
mmcgee-jump wants to merge 1 commit into
Conversation
mmcgee-jump
requested review from
yufeng-jump
and
a balanced review from Copilot
September 12, 2026 01:43
┌─ ⚡ PERF · 4e0ac6e vs main@de039cd ─────────────────────────────────
│ SUITE BASELINE NEW Δ
│ replay tps, mainnet 27,952 tps 27,835 tps · -0.42%
│ bench tps, localnet 762,977 tps 765,294 tps · +0.30%
│ snapshot load, testnet 9.31 s 9.21 s · -1.06%
│ mem total, mainnet 170.92 GiB 170.92 GiB · 0.00%
│ mem total, testnet 101.79 GiB 101.79 GiB · 0.00%
│ clean compile, firedancer 352.4 cpu·s 351.0 cpu·s · -0.41%
│ binary size, firedancer 85.99 MB 85.99 MB · 0.00%
├─────────────────────────────────────────────────────────────────────
@@ 0 REGRESSIONS · 0 WARNINGS · 0 IMPROVED · 7 NOISE @@
└─────────────────────────────────────────────────────────────────────history · 2 pushes ┌─ HISTORY · Δ vs main, per push, newest first ─────────────────────────
│ HEAD TPS BENCH SNAP MEM·M MEM·T COMPILE BINARY
│ 4e0ac6e -0.42% +0.30% -1.06% 0.00% 0.00% -0.41% 0.00%
│ f7a23e9 +0.03% -0.17% -0.41% 0.00% 0.00% +0.06% 0.00%
└─────────────────────────────────────────────────────────────────────── |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
One prefetch uses undefined pointer arithmetic, and scalar bitset mode misses a target cache line.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Optimizes pack insertion and eviction by prefetching data likely needed next.
Changes:
- Prefetches transaction bitsets before insertion finalization.
- Batches random eviction samples and prefetches their roots.
- Prefetches the likely next eviction candidate.
File summaries
| File | Description |
|---|---|
src/disco/pack/fd_pack.c |
Adds insertion and eviction prefetch optimizations. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
A pool element that was just evicted is cold, and delete_worst rolls eight random samples whose roots are eight cold lines fetched one at a time. Warm the bitset lines the insert will clear, roll the samples before reading them, and warm the successor the next eviction will delete. The successor is a guess, so it was measured: it is the next victim 27% of the time over 1027 evictions at a mean pool of 1032, against 0.8% for a uniform pick.
mmcgee-jump
force-pushed
the
mmcgee/pack-prefetch
branch
from
September 13, 2026 18:56
ce0b4b5 to
4e0ac6e
Compare
mmcgee-jump
enabled auto-merge (rebase)
September 13, 2026 19:35
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.
A pool element that was just evicted is cold, and delete_worst rolls eight random samples whose roots are eight cold lines fetched one at a time. Warm the bitset lines the insert will clear, roll the samples before reading them, and warm the successor the next eviction will delete.
The successor is a guess, so it was measured: it is the next victim 27% of the time over 1027 evictions at a mean pool of 1032, against 0.8% for a uniform pick.