Skip to content

packfile: reuse the open path's buffers - #1046

Draft
tamirms wants to merge 1 commit into
feature/full-historyfrom
tamirms/packfile-reuse-buffers
Draft

tamirms wants to merge 1 commit into
feature/full-historyfrom
tamirms/packfile-reuse-buffers

Conversation

@tamirms

@tamirms tamirms commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

What

  • The packfile open path takes its offsets table, index decode scratch and read buffers from pools, and returns them on every exit, failed opens included. A reader hands its offsets table back when it closes, once no read is still using it.
  • A buffer too large for its pool is dropped rather than kept. Drops are counted and exported as pooled_buffer_cap_skips_total.

Why

Cold reads open packfiles on every request, and each open allocated these buffers afresh.

Split out of #968.

Known limitations

  • Not benchmarked on its own. rpcv2: getEvents read-path performance across both tiers #968's cold allocation numbers (31.4 → 3.2 MB per request at sac density) include this together with the other fetch changes.
  • pooled_buffer_cap_skips_total should stay at zero; any other value means a pool's cap wants raising.

🤖 Generated with Claude Code

Opening a packfile allocated its offsets table, its index decode scratch
and its read buffers afresh every time, and cold reads open packfiles on
every request. The open path now takes these from pools and returns them
on every exit, failed opens included. A reader hands its offsets table
back when it closes, once no read is still using it.

A buffer too large for its pool is dropped rather than kept, and each
drop is counted and exported as pooled_buffer_cap_skips_total. The count
should stay at zero; any other value means a cap wants raising.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QHnF5BhsuoxpWxGmatQzmt
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