Skip to content

Commit a8bc0ec

Browse files
michaelglassclaude
andcommitted
Parallel per-file type checking with concurrent project check
Run ParseAndCheckProject and per-file ParseAndCheckFileInProject concurrently. The project check warms the FCS incremental builder; parallel per-file checks share the builder and benefit from its warmed state. Replaces sequential GetBackgroundCheckResultsForFileInProject which bypasses FCS caches and always re-checks. Benchmarked on a 24-file project: ~133s sequential → ~18s parallel. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 30d4e7c commit a8bc0ec

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

  • src/FSharpLint.Core/Application

src/FSharpLint.Core/Application/Lint.fs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -462,15 +462,21 @@ module Lint =
462462

463463
let filesToLint = files |> List.filter (not << isIgnoredFile)
464464

465-
// Check entire project first, then retrieve cached per-file results.
466-
// GetBackgroundCheckResultsForFileInProject reuses the project check
467-
// results rather than re-checking each file from scratch.
468-
let! projectCheckResults = checker.ParseAndCheckProject projectOptions
469-
470-
let! parsedFiles =
465+
// Run project check and per-file parse+check concurrently.
466+
// The project check warms the FCS incremental builder; parallel
467+
// per-file checks share the builder and benefit from its warmed state.
468+
let projectCheckAsync = checker.ParseAndCheckProject projectOptions
469+
let perFileAsync =
471470
filesToLint
472-
|> List.map (fun file -> ParseFile.getBackgroundFileResults file checker projectOptions)
473-
|> Async.Sequential
471+
|> List.map (fun file -> ParseFile.parseFile file checker (Some projectOptions))
472+
|> Async.Parallel
473+
474+
let! results = Async.Parallel [|
475+
async { let! r = projectCheckAsync in return box r }
476+
async { let! r = perFileAsync in return box r }
477+
|]
478+
let projectCheckResults = results.[0] :?> FSharpCheckProjectResults
479+
let parsedFiles = results.[1] :?> ParseFile.ParseFileResult<ParseFile.FileParseInfo>[]
474480

475481
let failedFiles = Array.choose getFailedFiles parsedFiles
476482

0 commit comments

Comments
 (0)