Skip to content

perf: cap/batch untracked-file diff subprocess fan-out - #36

Open
uditdc wants to merge 1 commit into
mainfrom
perf/10-batch-untracked-diff-fanout
Open

perf: cap/batch untracked-file diff subprocess fan-out#36
uditdc wants to merge 1 commit into
mainfrom
perf/10-batch-untracked-diff-fanout

Conversation

@uditdc

@uditdc uditdc commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Closes #10

GET /diff/working previously spawned one git diff --no-index subprocess per untracked file via Promise.all, so a repo with hundreds of untracked files (e.g. an accidental node_modules add) would fan out hundreds of concurrent processes.

This adds a small mapWithConcurrency helper in src/server/routes/diff.ts and uses it to cap the untracked-file diffing to 8 concurrent subprocesses instead of adding a new dependency for it.

Acceptance criteria

  • Add a concurrency cap or batch into fewer invocations — added mapWithConcurrency with a cap of 8 concurrent git diff --no-index calls in diffRoutes's /diff/working handler.
  • Verify manually or via a fixture with 200+ untracked files that process count stays bounded — tests/concurrency.test.ts exercises mapWithConcurrency with a 250-item fixture and asserts the number of in-flight calls never exceeds the configured limit (also covers full/in-order processing and edge cases like an empty list).

pnpm typecheck, pnpm test, and pnpm build all pass.


Generated by Claude Code

Bounds the fan-out in /diff/working to 8 concurrent `git diff
--no-index` calls instead of spawning one process per untracked file,
so a repo with hundreds of untracked files (e.g. an accidental
node_modules add) doesn't fork hundreds of processes at once.
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.

perf: cap/batch untracked-file diff subprocess fan-out

2 participants