Skip to content

perf(worktrees): index removal listing path membership - #41035

Draft
nwparker wants to merge 1 commit into
mainfrom
nwparker/perf-removal-listing-path-index
Draft

nwparker wants to merge 1 commit into
mainfrom
nwparker/perf-removal-listing-path-index

Conversation

@nwparker

@nwparker nwparker commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Local worktree listing checks each pending or failed removal against every Git row, repeatedly normalizing the same paths on the main thread. With 1,000 Git rows and 100 absent pending removals, the installed implementation reads Git-row paths 101,000 times. Indexing membership once reduces that to 1,000; listings without removal records now skip row processing entirely.

The matcher preserves the existing pairwise comparator's POSIX/Windows separation, macOS /private/tmp alias, WSL distribution case folding and case-sensitive ext4 tails, including mixed relative/Windows syntax. Failure decoration, checkout/replacement detection, leftover ordering and failure persistence retain their existing behavior. The index lives for one listing, so it needs no cross-refresh invalidation. Remote-host routing and folder-workspace behavior are unchanged.

Evidence: a quiet profile of installed hourly 6d3d8245b2f84d49decc482fea9eabced4fdabcf reached path comparison through this join. The current process had five failed removal records. The N×M join predates this hourly (introduced in b5869eeaae7, #23952); this is not an hourly-regression claim. No input stall was captured concurrently, and the deterministic counts do not establish milliseconds saved or explain all observed CPU.

Validation:

  • External production-source before/after count probe: 100 rows/10 removals, 1,100 → 100 row-path reads; 1,000/100, 101,000 → 1,000; no removals, 100 → 0. Original Git rows and output order preserved. IO/removal-table seams isolated; no user paths used.
  • External parity matrix: 2,958 membership comparisons against the existing comparator across darwin, linux, win32 arguments, including WSL UNC aliases and case-sensitive tails. Native Linux/Windows execution remains unverified.
  • Existing removal lifecycle and path-deduplication suites: 4 files, 42 passed, 16 platform skips (--maxWorkers=2). Includes real-Git macOS failure/recovery coverage.
  • pnpm tc:node passed.
  • Final pnpm check:changed --timeout=2: all 22 non-test checks passed, including node/web/CLI typechecks, formatting, lint, import boundaries and ratchets. The broad related-unit-test selection timed out after 120 seconds; this is incomplete broad-test coverage, not a passing gate. Scoped tests above completed successfully.
Files Added Deleted Net
Test 0 0 0 0
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​60 $\color{#cf222e}{\Huge{\mathbf{−}}}$​16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​44

This branch has not been deployed

No deployments
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