Performance: parallel per-file type checking#846
Conversation
Rather than reading it from FSharpCheckProjectResults on every use, which appears to have a substantional performance cost. refs fsprojects#770
|
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. |
|
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. |
a8bc0ec to
c7de224
Compare
|
going to rebase on your PR, I think that approach is better. |
c7de224 to
827ee64
Compare
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>
827ee64 to
b69d240
Compare
|
@michaelglass why did you close it? Sorry for being a bit MIA these past months, I dropped the ball. |
|
sorry it's been a long time. I should have left a comment! IIRC the bulk of the perf gain was actually #845. in this comment I discuss other perf explorations I did. I can rerun benchmarks on this branch but I'm pretty sure I closed it because the benefit outside of 845 was overstated. |
Summary
Massive performance improvement to the linting pipeline, built on top of #845.
Runs
ParseAndCheckProjectand per-fileParseAndCheckFileInProjectconcurrently usingAsync.Parallel. The project check warms the FCS incremental builder; parallel per-file checks share the builder and benefit from its warmed state.Also enables
parallelReferenceResolutiononFSharpChecker.Create.Performance
The speedup scales with file count — larger projects see dramatically larger gains.
Test plan
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