Skip to content

Perf: Throttle parallel typechecks in Find All References #20127

Description

@xperiandri

Problem

Project.FindFSharpReferencesAsync launches one CancellableTask per document in the project simultaneously via CancellableTask.whenAll, which can spawn an unbounded number of parallel typechecks at once when a project has many documents. This causes CPU spikes and background churn during Find All References / Rename.

Fix

Add CancellableTask.whenAllThrottled maxDegreeOfParallelism, which uses a SemaphoreSlim to cap the number of concurrently running tasks while preserving cancellation semantics. Apply it in Project.FindFSharpReferencesAsync (in WorkspaceExtensions.fs), capping concurrency to max 1 Environment.ProcessorCount.

Files

  • vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs
  • vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs

Activity

  1. added this to the Backlog milestone on Aug 3, 2026
  2. 14 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions