Repository navigation
perf(server): branch lists no longer wait on folder checks one at a time - #1020
Merged
Merged
Conversation
vcs.listRefs took 1.5s typical and up to 16s on a repository with ~90 worktrees. Traces put most of it in parseWorktreeList (up to 6.4s): it stat'ed each `git worktree list` entry's folder one after another, and on a busy server each stat waits its turn. VcsProjectConfig.findConfigPath did the same walking up parent folders (0.6-1.2s). Both now run their checks side by side. parseWorktreeList reuses parseWorktreeRegistrations (now tolerant of CRLF output) and stats up to 64 folders at once; results and order are unchanged. findConfigPath checks every candidate at once and answers as soon as the nearest existing one is known, so a stalled check further up (an unreachable mount) doesn't hold it. On the real 90-worktree repository with a simulated busy event loop, the folder checks went from 2.7s to 30ms.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch was previously deployed
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.
Listing branches (
vcs.listRefs, used by the branch picker and by every new worktree thread) took 1.5s typical and up to 16s on a repository with ~90 worktrees. The server traces put most of it inparseWorktreeList, up to 6.4s: it checked eachgit worktree listentry's folder one stat at a time, and on a busy server every stat waits its turn.VcsProjectConfig.findConfigPathdid the same walking up parent folders (0.6 to 1.2s per call).Both now run their checks side by side:
parseWorktreeListreusesparseWorktreeRegistrationsand checks up to 64 folders at once. Results are unchanged: missing folders are skipped, git's order is kept, and so are branch and lock reason. The shared parser now handles CRLF output too.findConfigPathchecks every candidate at once and answers as soon as the nearest existingvcs.jsonis known, so a stalled check further up (an unreachable network mount) doesn't hold it.Measured on the real 90-worktree repository with a simulated busy event loop: the folder checks went from 2.7s to 30ms. When the server is idle, both ways take a few milliseconds.
Tests: two new cases in
VcsProjectConfig.test.ts: the nearest config wins, and a check further up that never answers doesn't block the lookup. The second one hangs on a version that waits for every check. Existing worktree-listing tests cover skipped folders and lock reasons. 305 git-related server tests pass, along with fmt, lint and typecheck. Reviewed by GPT-6.2-Astra; both of its findings (stalled check, CRLF) are fixed here.Not in this PR: a listing is read twice when a background remote fetch finishes during it, and filesystem calls on a busy server wait about 70ms each, which suggests broader event-loop load.