Skip to content

pack: prefetch what insert and eviction are about to read - #11435

Open
mmcgee-jump wants to merge 1 commit into
mainfrom
mmcgee/pack-prefetch
Open

pack: prefetch what insert and eviction are about to read#11435
mmcgee-jump wants to merge 1 commit into
mainfrom
mmcgee/pack-prefetch

Conversation

@mmcgee-jump

Copy link
Copy Markdown
Contributor

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 mmcgee-jump added this to the v26.10 milestone Sep 12, 2026
@mmcgee-jump
mmcgee-jump requested review from yufeng-jump and a balanced review from Copilot September 12, 2026 01:43
@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown
 ┌─ ⚡ 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%
 └───────────────────────────────────────────────────────────────────────

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread src/disco/pack/fd_pack.c Outdated
Comment thread src/disco/pack/fd_pack.c Outdated
Copilot AI review requested due to automatic review settings September 13, 2026 18:55
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes preserve behavior while safely improving cache-access latency.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI review requested due to automatic review settings September 13, 2026 18:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The cache-warming changes preserve existing selection and deletion behavior without introducing correctness issues.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@mmcgee-jump
mmcgee-jump enabled auto-merge (rebase) September 13, 2026 19:35
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.

2 participants