Skip to content

perf(paths): one files:resolve call per batch, thread root resolved once (#1475) - #1484

Merged
currentbits merged 2 commits into
mainfrom
coder/perf-g-resolve-batch-files-resolve-e03efc
Oct 5, 2026
Merged

currentbits merged 2 commits into
mainfrom
coder/perf-g-resolve-batch-files-resolve-e03efc

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Part of #1475, main-process finding 5. Opening one large thread fired 424 separate files:resolve IPCs, costing 131 ms of main-process time during first render.

What changed

  • Renderer: PathLinkProvider queues every component's lookups and flushes them in a microtask as one resolver call, chunked at 500 paths. It dedupes in-flight paths, and a generation counter stops a thread switch from caching the previous thread's results. Failed lookups aren't cached, so a later render retries them.
  • Main: files:resolve resolves the thread root once per call instead of once per path (tryResolveWorkspaceFiles). The per-call cap rises from 80 to 500, matching the renderer's chunk size.

Verified independently. Old and new handlers were compared on a clone of the real store, using the largest 40 transcripts and every path-like token in them (8,249 paths):

  • Output: identical results for all 40 threads.
  • Main-process time: 366 ms → 84 ms. The remainder is per-path existsSync.
  • Worker's measurement: about 577 ms → 3 ms main-process time on one large thread, counting the IPC fan-out it replaces.

Suites:

  • Typecheck exits 0.
  • On a heavily loaded machine (load average ~46), the full renderer suite cancelled 9 files at the 20 s file timeout and the electron suite had 1 known load flake (mcp-inject). All of those pass when re-run on their own: 380 of 380 renderer tests and 13 of 13 in mcp-inject. The electron suite otherwise passed 4144 tests.

🤖 Generated with Claude Code

Willem and others added 2 commits October 5, 2026 21:23
Each path used to repeat store.getThread (a linear scan) and getProject.
Raise the per-call cap from 80 to 500 so a batched renderer request fits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1475)

useResolvedMap asked once in render and again in its effect, per block, so
opening a large thread sent hundreds of files:resolve IPCs. The provider now
queues uncached paths for a microtask flush, dedupes in-flight lookups, and
does not cache a failed lookup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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