Skip to content

Perf: Throttle parallel typechecks in Find All References - #20128

Open
xperiandri wants to merge 2 commits into
dotnet:mainfrom
xperiandri:fix-find-references-throttle
Open

Perf: Throttle parallel typechecks in Find All References#20128
xperiandri wants to merge 2 commits into
dotnet:mainfrom
xperiandri:fix-find-references-throttle

Conversation

@xperiandri

Copy link
Copy Markdown
Contributor

Fixes #20127

Problem

Project.FindFSharpReferencesAsync launched one CancellableTask per document in the project simultaneously via CancellableTask.whenAll, causing an unbounded number of parallel typechecks (one per document) at once during Find All References / Rename.

Fix

  • Added CancellableTask.whenAllThrottled maxDegreeOfParallelism in CancellableTasks.fs, using a SemaphoreSlim to cap concurrency while preserving cancellation semantics.
  • Applied it in Project.FindFSharpReferencesAsync (WorkspaceExtensions.fs), capping concurrency to max 1 Environment.ProcessorCount.

@xperiandri
xperiandri marked this pull request as ready for review August 3, 2026 19:32
@xperiandri
xperiandri requested a review from a team as a code owner August 3, 2026 19:33
@github-actions github-actions Bot added the AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files label Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Perf: Throttle parallel typechecks in Find All References

1 participant