Cache watched rg file inventories#31939
Draft
jif-oai wants to merge 1 commit into
Draft
Conversation
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.
Why
Repeated
rg --filescalls rescan the same repository metadata. On a 34 GB monorepo that costs about 3.5 seconds per call, and concurrent agent turns make the contention worse.This is the second PR in the transparent exec-server
rgacceleration stack. It adds the cache mechanism behind the packaged shim, but deliberately does not expose it to executor children yet; the next PR owns that sandbox boundary.What
rgto build the canonical--filesinventoryrg --filesform, only at the canonical Git worktree root, and only withoutRIPGREP_CONFIG_PATHrgThe cache is ephemeral, private to one process, and contains only stock
rgoutput. No index format or search semantics are introduced here.Safety boundaries
rgBenchmarks
Measured on Apple Silicon / macOS 26.5.2 with ripgrep 15.1.0 against
/Users/jif/code/openaiat5ee72035d863ff9f79a10735be60a1a07066cc9f(34 GB, 962,820 visible paths). The candidate was release-built from944c9cf7947a7e6f17b1e3cb850688ecab9e9bc1.The initial watched inventory took 3.756 s to build and occupied 73,143,023 bytes. Stock and cached results had the same line count, byte count, and unordered SHA-256 digest. The benchmark used two warmups, randomized pair order, bootstrap confidence intervals for the paired median speedup, and exact two-sided sign tests.
rgmedianThe concurrent figures are whole-batch wall times. A separate live watcher check created and removed a file after publication; both refreshed inventories matched stock
rg, with 37.6 ms and 38.8 ms observed refresh latency respectively. That check is a correctness probe, not a statistically powered latency claim.Checks
just test -p codex-rg --features manager(6 passed)just bazel-lock-checkfrom an exact detached worktree at this commitcargo metadata --locked --no-deps --format-version 1from that exact worktreejust fmtStack