dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.92k stars 786 forks source link

An F# or C# shebang executable should use a cached binary on subsequent runs #17217

Open vsfeedback opened 5 months ago

vsfeedback commented 5 months ago

This issue has been moved from a ticket on Developer Community.


I wrote an F# shebang. It starts up slowly, of course.

It would be good if .NET would provide infrastructure to compile a shebang with AOT (in the background), cache the result, and use the result for subsequent runs. By comparing the shebang file against a hash stored with the cached binary, the system can respond appropriately if the shebang has changed.

Years ago I implemented a version of this technique called “compileAndGo”. It works great.


Original Comments

Feedback Bot on 11/17/2023, 06:21 AM:

(private comment, text removed)

abelbraaksma commented 5 months ago

So, I hope I'm not misunderstanding, but you basically seem to suggest the process of compiling F# source files through the fsc command? The output is a binary file that is optimized for loading by the .NET Runtime and when recompiling, it will only do so if the hash of the file has changed.

Similarly, the language service of F# does this too, but then for individual source files and much more.