-
Notifications
You must be signed in to change notification settings - Fork 844
Read/store ILCustomAttrs, ILSecurityDecls, ILTypeDef sensibly #4597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@dotnet-bot Test Ubuntu16.04 Release_fcs Build please |
|
Here's an analysis of the cumulative effect of changes #4586, #4590 , #4597. Scenario:
That's over 50% reduction in managed heap, and 38% reduction in overall memory usage. Master + this PR: |
|
That's a ridiculously good result :-) What implications does this have in terms of performance - is there any reduction in perf? |
Not as far as I'm aware. The only thing I'm aware of is that the F# compiler (fsc.exe, not Visual Studio) uses memory mapped files less often, preferring byte[] in some cases to avoid locking files. |
|
@dotnet-bot Test Ubuntu16.04 Release_default Build please |
|
@isaacabraham Note this includes @AviAvni's memory work. It's great to see that, once ByteFile is removed, we've been focusing on the right data structures. |
|
@dsyme Thanks for letting me know I can work on Typar just waited until you finish your great work |
|
This is wonderful. |
| let result : LoadClosure = | ||
| { SourceFiles = List.groupByFirst sourceFiles | ||
| References = List.groupByFirst references | ||
| { SourceFiles = List.groupBy fst sourceFiles |> List.map (map2Of2 (List.map snd)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these doing? What is map2of2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TIHan in visualfsharp\src\fsharp\lib.fs
let map2Of2 f (a1,a2) = (a1,f a2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I removed the groupByFirst helper (which was a reimplementation of groupBy) but then had to add these since the returned results were slightly different - I should have added a new groupByFirst helper implemented in terms of groupBy
|
@Krzysztof-Cieslak @nosami @auduchinok FCS updated and published as FSharp.Compiler.Service 22.0.1 |
|
Great work. Is this change incorporated in the VS 15.7 previews? |
|
@eiriktsarpalis not yet. We'll need to make another insertion into a preview release branch before it goes out on that channel. |
…#4597) * Read/store ILCustomAttrs, ILSecurityDecls, ILTypeDef sensibly (dotnet#4597) * hide representation of ILPreTypeDef * fix build * remove unnecessary use of lists with repeated tail-appends * add comment * fix test




The memory trace here shows a Gomorrah of objects associated with ILCustomAttrs, ILSecurityDecls, ILTypeDef, accounting for 10-20% (perhaps more) of long-term managed memory use when editing in VisualFSharp.sln. The same will be true in other large solutions.
This has long been a problem and instead of fiddling (e.g. reducing the size of these objects) it's better to solve it more properly.
The underlying problem is that we rely too much on per-TypeDef, per-MethodDef, per-PropertyDef etc. closures to capture the continuations needed to read the rest of these data structures. In each case, all that's really needed is a single shared closure (which captures the reading context) plus a metadata token. This PR implements this.
This should eliminate most of these items from the linked comment:
TODO: