Hide record representations in Abstract IL #4596
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Abstract IL types are appearing very high on the list of memory usage now that we have memory a dump of VisualFSharp.sln in action
In order to make progress on this, we need to cleanup some of the representations used. For example
CustomAttributeson ILEventDef, ILMethodDef, ILTypeDef and ILProeprtyDef is currently always a closure that recomputed the custom attributes. That's ok, but the record-of-closures is a worse representation than a simple object with a property. We will need to be able to adjust the representation locally inil.fsto improve thingsSimilarly,
SecurityDeclsis a lazy object, even though we basically never look at, and even when empty. This can be represented far more efficiently.Just these two alone can shave > 10% of memory usage.
As a first step, this PR hides moves away from using records in il.fs/il.fsi and uses an immutable class for each of these.
The PR is straight-forward conversion from records to classes.
This PR is best viewed with whitespace insensitivity