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.88k stars 783 forks source link

Fix primary assembly heuristic + clean up duplicate code #17151

Closed vzarytovskii closed 4 months ago

vzarytovskii commented 4 months ago

Description

This fixes primary assembly check by:

  1. Using Equals, which will use span helpers on latest runtime
  2. Fixing the logic (before it used Compare <> 0 || ... now its just Equals ||, which will exit on the first match, as opposed to checking everything.
  3. It will also now inline correctly (see stacks in the attached profiles.

It also gets rid of specific cache for int32 in the ilreader, as well as hides stats under define.

FSI startup is a bit faster on M2, should be more noticeable on older/slower machines:

Before:

image

After:

image

Before: dotnet_trace_before.speedscope.json After: dotnet_trace_after.speedscope.json

github-actions[bot] commented 4 months ago

:warning: Release notes required, but author opted out

[!WARNING] Author opted out of release notes, check is disabled for this pull request. cc @dotnet/fsharp-team-msft

vzarytovskii commented 4 months ago

Also a note - we spend quite some time generating PDB in all scenarios, even though it will never be used. Around 1/3rd of total assembly generation time, for example on my M2 it takes 50ms to generate metadata and additional 24ms to generate pdb.

abonie commented 4 months ago

Also a note - we spend quite some time generating PDB in all scenarios, even though it will never be used. Around 1/3rd of total assembly generation time, for example on my M2 it takes 50ms to generate metadata and additional 24ms to generate pdb.

Should we create an issue about it to keep track?

vzarytovskii commented 4 months ago

Also a note - we spend quite some time generating PDB in all scenarios, even though it will never be used. Around 1/3rd of total assembly generation time, for example on my M2 it takes 50ms to generate metadata and additional 24ms to generate pdb.

Should we create an issue about it to keep track?

I did already. Not sure why it didn't link it here.

Nvm, it did: https://github.com/dotnet/fsharp/issues/17152