GeezerVison is showing github.com — perf(server): scan checkpoint ls-files output by record, not by byte by hieu-lee · Pull Request #26687 · pingdotgg/t3code
Conversation
Every turn-end checkpoint capture streams git ls-files --full-name --sparse -v -z for the whole repository through an onStdoutChunk callback, which looped over every byte in JS with for…of. On large repositories this blocks the server event loop for tens of milliseconds per turn.
The callback now jumps between NUL record terminators with Uint8Array.indexOf, checks only the tag byte at the start of each record, and copies record bytes only for skipped (S) records under sparse checkout. Parser state still carries across chunks, so records split between chunks behave as before. specialFlags and skippedPaths come out the same.
Measurements
Harness: the old and new callbacks copied verbatim into a scratch module and fed identical 64 KiB chunks of ls-files -v -z output. 5 warmup rounds, then 9 interleaved runs per implementation, median reported. --expose-gc --max-semi-space-size=512 so heapUsed deltas track allocation. Node 24.18, macOS (Apple Silicon).
| Input |
Before |
After |
| Real repo (this checkout, 28,875 files, 2.1 MB) |
10.19 ms |
0.93 ms (11x) |
| Synthetic 100k files, 4.8 MB |
21.4 ms, 15.7 MB heap |
2.7 ms, 13 KB heap |
| Synthetic 300k files, 14.5 MB |
61.8 ms |
7.0 ms |
What limits the new number: native indexOf scanning for NUL across the buffer, which is memory bandwidth bound. The JS work is now one tag check per record.
Benchmark script (real repo)
// lsfiles.mjs exports oldScanner/newScanner: the old and new callback bodies verbatim.
import { spawnSync } from "node:child_process";
import { oldScanner, newScanner } from "./lsfiles.mjs";
const cwd = process.argv[2];
const out = spawnSync("git", ["ls-files", "--full-name", "--sparse", "-v", "-z"], { cwd, maxBuffer: 1 << 30 }).stdout;
const chunks = []; for (let o = 0; o < out.length; o += 65536) chunks.push(out.subarray(o, o + 65536));
const run = (make) => { const s = make(false); for (const c of chunks) s.onStdoutChunk(c); return s.result(); };
for (let w = 0; w < 5; w++) { run(oldScanner); run(newScanner); }
const t = { old: [], new: [] }, a = { old: [], new: [] };
for (let k = 0; k < 9; k++) for (const [n, m] of [["old", oldScanner], ["new", newScanner]]) {
gc(); const h = process.memoryUsage().heapUsed; const t0 = performance.now(); run(m);
t[n].push(performance.now() - t0); a[n].push(process.memoryUsage().heapUsed - h);
}
const med = (x) => x.toSorted((p, q) => p - q)[x.length >> 1];
for (const n of ["old", "new"]) console.log(n, med(t[n]).toFixed(2), "ms", med(a[n]), "B heap");
Validation
GitVcsDriver.test.ts: 56/56 pass, including the existing sparse, skip-worktree, assume-unchanged, and split-record capture cases. (With my global git config, one unrelated remote-URL test fails because of a url.insteadOf rewrite. It passes with GIT_CONFIG_GLOBAL=/dev/null.)
- Differential fuzz, old vs new: 20,000 random byte streams × sparse on/off, random 1–6 byte chunk splits, empty records, invalid UTF-8, trailing
/, lowercase/S/H tags, missing final NUL. Identical specialFlags and skippedPaths every time.
vp run check:changed: format, lint, knip, and typecheck pass.
Not checked: Windows. The change is pure byte scanning, so nothing platform-specific is involved.
Authored with Claude Opus 5.5 via the Claude Code harness in T3 Code.
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Every checkpoint capture streams `git ls-files -v -z` for the whole
repository and inspected each byte in JS. Jump between NUL terminators
with indexOf and look only at each record's tag byte instead.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Approvability
Verdict: Approved at 988e364
Macroscope's review found this PR approvable — Checkpoint capture now scans Git output by NUL-delimited record to reduce processing overhead in large repositories. The change retains existing sparse-checkout handling and temporary-index safeguards without changing product defaults.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between 9826dbb and 988e364.
Files selected for processing: 1
-
apps/server/src/vcs/GitVcsDriver.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Walkthrough
-
The checkpoint index scan now uses indexOf to locate NUL delimiters. It retains checks for special index flags, collection of sparse-checkout skipped paths, and detection of non-UTF-8 paths.
Changes: Git index scan
| Layer / File(s) |
Summary |
Scan NUL-delimited index records apps/server/src/vcs/GitVcsDriver.ts |
The stdout scan uses indexOf to advance between NUL-delimited records. It retains special-flag checks and sparse-checkout skipped-record byte collection. |
Priority: Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Refactor
Suggested reviewers: juliusmarminge
Merge Risk: Minimal · up to 988e3
-
No merge-blocking issue was found in the checkpoint scan update.
Pre-merge checks: 3 · 1
-
Failed checks: 1 warning
| Check name |
Status |
Explanation |
Resolution |
| Description check |
 |
The description covers the problem (per-byte JS loop blocking the event loop on large repos), the change (indexOf-based NUL scanning, tag-byte check, sparse skipped-record copy), measurements, and val… |
Add the 'Scope and approval' section. Link the triaged bug issue or the discussion with the maintainer approval comment. If no issue exists, explain why this focused perf fix qualifies as a very small, obvious change under the template's ex… |
Passed checks: 3 passed
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the main change: the checkpoint ls-files output scan now steps between NUL records instead of checking every byte. It uses the conventional commit format and matches the raw summary an… |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Title check
-
Explanation
The title names the main change: the checkpoint ls-files output scan now steps between NUL records instead of checking every byte. It uses the conventional commit format and matches the raw summary and objectives. It is 68 characters, which is within a normal title length.
Full details: Description check
-
Explanation
The description covers the problem (per-byte JS loop blocking the event loop on large repos), the change (indexOf-based NUL scanning, tag-byte check, sparse skipped-record copy), measurements, and validation. It follows the template's Problem, Change, and Verification intent. The 'Scope and approval' section is missing: it has no linked triaged issue or maintainer-approved discussion, and no explanation of why the change qualifies without one. The Verification section is strong, and it names the test run, fuzzing, and the unchecked Windows case.
Resolution
Add the 'Scope and approval' section. Link the triaged bug issue or the discussion with the maintainer approval comment. If no issue exists, explain why this focused perf fix qualifies as a very small, obvious change under the template's exemption. The rest of the description can stay as written. The template also asks for the model and harness used, and the description already includes this.
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@juliusmarminge ready for review. Checkpoint capture's ls-files -v -z scan went from 10.2 ms to 0.93 ms on a real 28.9k-file repo (about 11x), with a differential fuzz against the old scan. Related to #21328 and #9661 S3 only in touching the same capture path; it does not change what git re-hashes. CI workflows on this fork PR show action_required, so they are waiting on a maintainer to approve the run. CodeRabbit and Macroscope are done with no open findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 28, 2026
Note 🤖 Claude Opus 5.5 responding on behalf of Theo
Closing: this is covered by #21329, which landed. Reopen if a needed part is still missing.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:S
10-29 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|