fsharp
fsharp copied to clipboard
Transparent Compiler memory reduction in editors
Description
This fixes #16979 with some additions that have been discussed in various chats/twitter threads. I've combined them for discussion purposes, we can split them up as desired.
The 3 parts are:
- Makes the snapshots -> options use a
ConditionalWeakTablerather than recreating possibly hundreds of options objects. - Adds many various knobs to the transparent compiler caching code, allowing tweaking for editors.
- Adds FsAutocomplete to the list of
InternalsVisibleToso we can utilize these cache tweaking changes.- FCS has never bee backwards compatible and FSAC has always had to deal with source level changes so any concerns around versioning wouldn't really apply here. We're used to it 😄
❓ Outstanding questions ❓
- What type of benchmarking should I do for this?
- I could show before/after on allocations in FSAC.
- Add a benchmark dotnet scenario but I'm unsure how big a project graph needs to be before this exhibits the behavior.
Checklist
-
[ ] Test cases added
-
[ ] Performance benchmarks added in case of performance changes
-
[ ] Release notes entry updated:
Please make sure to add an entry with short succinct description of the change as well as link to this pull request to the respective release notes file, if applicable.
Release notes files:
- If anything under
src/Compilerhas been changed, please make sure to make an entry indocs/release-notes/.FSharp.Compiler.Service/<version>.md, where<version>is usually "highest" one, e.g.42.8.200 - If language feature was added (i.e.
LanguageFeatures.fsiwas changed), please add it todocs/releae-notes/.Language/preview.md - If a change to
FSharp.Corewas made, please make sure to editdocs/release-notes/.FSharp.Core/<version>.mdwhere version is "highest" one, e.g.8.0.200.
Information about the release notes entries format can be found in the documentation. Example:
- More inlines for Result module. (PR #16106)
- Correctly handle assembly imports with public key token of 0 length. (Issue #16359, PR #16363)
*
while!(Language suggestion #1038, PR #14238)
If you believe that release notes are not necessary for this PR, please add
NO_RELEASE_NOTESlabel to the pull request. - If anything under
:heavy_exclamation_mark: Release notes required
:white_check_mark: Found changes and release notes in following paths:
Change path Release notes path Description src/Compilerdocs/release-notes/.FSharp.Compiler.Service/9.0.200.md
I could show before/after on allocations in FSAC.
Yeah, that's good enough. Also, if possible, CPU consumption.
In terms of why I want to get this fix in:
My work project is around 70 projects. This is the use after a full typecheck of the solution in FSAC:
Background Compiler:
Transparent Compiler:
(Actually this wasn't a full typecheck because I ran out of memory and it wouldn't finish)
Transparent Compiler (with this PR):
I can't seem to run the ilverify.ps1 script
& : The module 'fsharp' could not be loaded. For more information, run 'Import-Module fsharp'.
At C:\Users\jimmy\Repositories\public\TheAngryByrd\fsharp\tests\ILVerify\ilverify.ps1:41 char:7
+ & $script -c $configuration $additional_arguments
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (fsharp\build.sh:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoLoadModule
I can't seem to run the ilverify.ps1 script
& : The module 'fsharp' could not be loaded. For more information, run 'Import-Module fsharp'. At C:\Users\jimmy\Repositories\public\TheAngryByrd\fsharp\tests\ILVerify\ilverify.ps1:41 char:7 + & $script -c $configuration $additional_arguments + ~~~~~~~ + CategoryInfo : ObjectNotFound: (fsharp\build.sh:String) [], CommandNotFoundException + FullyQualifiedErrorId : CouldNotAutoLoadModule
It requires pwsh, not powershell (i.e. version 7, not 5).
In terms of why I want to get this fix in:
[...]
Wow all of that because of the extra FSharpOptions 😲 Or did you tweak the cache sizes also?
AWESOME!
Thank for merging this.
@T-Gro do you have any idea what SDK release this will make it into? Is this branch still inserting into 9.0.200?
❤️ Thank you for finishing this up!
@T-Gro do you have any idea what SDK release this will make it into? Is this branch still inserting into 9.0.200?
fsharp's main is not inserting into 17.13 automatically anymore, but Petr did one last manual merge to get this in -> it should still land in 9.0.200
@T-Gro do you have any idea what SDK release this will make it into? Is this branch still inserting into 9.0.200?
fsharp's
mainis not inserting into 17.13 automatically anymore, but Petr did one last manual merge to get this in -> it should still land in 9.0.200
That's great news :) FSAC is considering a nightly release to get just this feature because I was worried that we'd have to wait until 9.0.300.