String allocations from fullNameOfEntitityRef when used in ItemsAreEffectivelyEqual - necessary?
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
I took a sample of editing some code across several in FSharp.Editor.dll and noticed that there's a _lot_ of string allocations happening in `ItemsAreEffectivelyEqual`. In only 37 seconds it allocated **84 MB**. Most of these are small and short-lived, but it still feels excessive.
Two routines are involved, both allocating a lot:


Looking at the code, this happens when checking `Item.ModuleOrNamespaces` here:
https://github.com/dotnet/fsharp/blob/2571fe75185b057828532faa1f1b037b164a8a03/src/fsharp/NameResolution.fs#L1813-L1816
And it appears to be a "only do this if everything else failed" check.
Is it necessary? This is a lot of string allocations, and when combined makes up the bulk registered by profiling when editing code. Note that the source of these allocations is **unused opens analysis**.
Contributor guide
Assessment
This issue has not been assessed yet.