Hey there, let’s cut to the chase: the dotnet
7.0.400 SDK release brings some feature flags that can turbocharge your F# compiler.
In this post, I’m shining a spotlight on three of these gems that you absolutely need to give a spin.
First things first, you need the latest SDK (
7.0.400 and beyond). Then, let’s tweak some
<OtherFlags> to fine-tune the F# compiler in MSBuild.
Just drop this snippet into your
<OtherFlags>$(OtherFlags) --test:GraphBasedChecking --test:ParallelOptimization --test:ParallelIlxGen</OtherFlags>
Want to double-check if it’s working? Run
dotnet build --no-incremental -v n and spot the extra compiler flags in
C:\Program Files\dotnet\dotnet.exe "C:\Program Files\dotnet\sdk\7.0.400\FSharp\fsc.dll" -o:obj\Debug\netstandard2.0\YourProject.dll ... --test:GraphBasedChecking --test:ParallelOptimization --test:ParallelIlxGen
But what magic do these flags weave, you ask? They sprinkle their fairy dust over the various phases of F# compilation.
Now, let’s keep it breezy on the technical stuff:
--test:GraphBasedCheckingjuggles type-checking in parallel, wherever possible. See dotnet/fsharp#14494
--test:ParallelOptimizationhosts a parallel party during certain optimization phases. See dotnet/fsharp#14390
--test:ParallelIlxGenorchestrates parallel code generation for method bodies in the IlxGen dance. See dotnet/fsharp#14372
It’s a kinda magic, that’s what! ✨🎩
Big shout-out to Janusz Wrobel and Tomas Grosup – these rockstars took the compiler to new heights! Their skills and hustle are seriously awe-inspiring. As for me, well, let’s just say I added my own sprinkle of magic to the mix. Teamwork at its finest, folks! 🚀🌟
Otherwise there is no way of telling if this can ever become the default in dotnet 8!
Clear enough I hope 😸.