Skip to content

Performance: parallel per-file type checking#846

Draft
michaelglass wants to merge 2 commits intofsprojects:masterfrom
michaelglass:perf/skip-type-check-and-fix-async-naming-overhead
Draft

Performance: parallel per-file type checking#846
michaelglass wants to merge 2 commits intofsprojects:masterfrom
michaelglass:perf/skip-type-check-and-fix-async-naming-overhead

Conversation

@michaelglass
Copy link

@michaelglass michaelglass commented Feb 24, 2026

Summary

Massive performance improvement to the linting pipeline, built on top of #845.

Runs ParseAndCheckProject and per-file ParseAndCheckFileInProject concurrently using Async.Parallel. The project check warms the FCS incremental builder; parallel per-file checks share the builder and benefit from its warmed state.

Also enables parallelReferenceResolution on FSharpChecker.Create.

Performance

Project Before (sequential) After (parallel) Speedup
FSharpLint.Core (15 files) 15.4s 12.5s ~1.2x
my internal project (48 files, many huge reps) 658s ~25s ~25x

The speedup scales with file count — larger projects see dramatically larger gains.

Test plan

  • Full test suite passes (1003 unit + 26 console + 13 functional)
  • Verified identical warning count between sequential and parallel approaches
  • Type-check-dependent rules (FL0065 hints, FL0085 tail call diagnostics, FL0095 sync naming) produce correct results in parallel mode

A note on this PR

This PR was developed with significant AI assistance. I understand if that's not welcome — apologies if so. Happy to discuss the changes or withdraw the PR.

🤖 Generated with Claude Code

Rather than reading it from FSharpCheckProjectResults on every use,
which appears to have a substantional performance cost.

refs fsprojects#770
greptile-apps[bot]

This comment was marked as off-topic.

@michaelglass michaelglass marked this pull request as draft February 24, 2026 14:41
@Numpsy
Copy link
Contributor

Numpsy commented Feb 24, 2026

Fwiw I was having a go at passing the project options down from the top in #845 which avoids some of this overhead and avoids a larger perf regression when using the .NET 10 version of FCS, not sure what the best approach is though.
( I also wondered if just passing the project name in directly and avoiding dependencies on the project options would simplify things, if that's the only property that's needed)

@michaelglass
Copy link
Author

oh nice. Yeah I've been doing a deeper dive on fsharplint perf because on one of my projects, it takes 5 minutes to run.

@michaelglass michaelglass force-pushed the perf/skip-type-check-and-fix-async-naming-overhead branch from a8bc0ec to c7de224 Compare February 25, 2026 03:56
@michaelglass michaelglass changed the title Performance: fix per-node overhead and compute rules once per project Performance: parallel type checking, compute rules once, fix per-node overhead Feb 25, 2026
@michaelglass
Copy link
Author

going to rebase on your PR, I think that approach is better.

@michaelglass michaelglass force-pushed the perf/skip-type-check-and-fix-async-naming-overhead branch from c7de224 to 827ee64 Compare February 25, 2026 04:09
Run ParseAndCheckProject and per-file ParseAndCheckFileInProject
concurrently using Async.Parallel. The project check warms the FCS
incremental builder; parallel per-file checks share the builder
and benefit from its warmed state. Also enable
parallelReferenceResolution on FSharpChecker.

Benchmarked on a 24-file project: ~145s sequential to ~18s parallel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@michaelglass michaelglass force-pushed the perf/skip-type-check-and-fix-async-naming-overhead branch from 827ee64 to b69d240 Compare February 25, 2026 09:08
@michaelglass michaelglass changed the title Performance: parallel type checking, compute rules once, fix per-node overhead Performance: parallel per-file type checking Feb 25, 2026
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.

2 participants