Skip to content

Conversation

@dsyme
Copy link
Contributor

@dsyme dsyme commented Mar 21, 2018

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

  • CustomAttributes on 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 in il.fs to improve things

  • Similarly, SecurityDecls is 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

@dsyme dsyme merged commit 3273ed0 into dotnet:master Mar 22, 2018
@dsyme
Copy link
Contributor Author

dsyme commented Mar 22, 2018

This is a straight-forward conversion of records to classes, I will merge

customAttrs = defaultArg customAttrs x.CustomAttrs)

member x.ParameterTypes = typesOfILParams x.Parameters
// Whidbey feature: SafeHandle finalizer must be run
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked that comment ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants