fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

Building a large F# project is indeterminately slow

Open ners opened this issue 1 month ago • 3 comments

I've created a very simple F# project with 10'000 modules: https://github.com/ners/fsharp-10k

Running dotnet build in this project appears to never complete; I killed the process after 10 minutes after it had consumed most of my RAM.

Repro steps

  • Check out https://github.com/ners/fsharp-10k
  • Run dotnet build

Expected behavior

The build completes in a reasonable amount of time, e.g. 10 minutes.

Ideally the progress of the build is reported to the CLI, e.g.: [123/1000]

Actual behavior

The build takes an indeterminate amount of time.

Related information

I have a reasonably powerful setup (Ryzen 9950X) running Linux and using .NET 10.0.100. I also tested with 8.0.416, where the result was the same.

ners avatar Dec 04 '25 10:12 ners

Thanks for the report, let us take a look. There is a compile time perf regression in 10.0.100 for specific patterns of code, it is fixed in code already.

I will check it.

T-Gro avatar Dec 04 '25 10:12 T-Gro

Thanks for the report, let us take a look. There is a compile time perf regression in 10.0.100 for specific patterns of code, it is fixed in code already.

I'm betting it's something else this time, because it's as slow with sdk 8.

majocha avatar Dec 04 '25 14:12 majocha

Looks like a GC issue (15GB memory usage after 5K modules). Its not that much code, but the fact its being split into 10K files likely means extensive copies of allocations and/or references held.

T-Gro avatar Dec 04 '25 15:12 T-Gro