Skip to content
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

3.1% allocations of TypeConversions #68997

Closed
Youssef1313 opened this issue Jul 12, 2023 · 3 comments · Fixed by #69040
Closed

3.1% allocations of TypeConversions #68997

Youssef1313 opened this issue Jul 12, 2023 · 3 comments · Fixed by #69040
Labels
Area-Compilers help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Milestone

Comments

@Youssef1313
Copy link
Member

image

image

Allocations happen here:

var conversions = new TypeConversions(method.ContainingAssembly.CorLibrary);

Does it make sense to introduce a lazy TypeConversions property on assembly symbol, and use it instead of creating TypeConversions instances?

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 12, 2023
@Youssef1313
Copy link
Member Author

@jaredpar
Copy link
Member

Does it make sense to introduce a lazy TypeConversions property on assembly symbol, and use it instead of creating TypeConversions instances?

Our AssemblySymbol instances are long lived hence that extra allocation will effectively just grow the size of every instance. Not sure that is the best approach. Did you consider attaching it to say the compilation or another symbol relevant to the scenario?

@CyrusNajmabadi

@CyrusNajmabadi
Copy link
Member

The symbols are long lived. But there are relatively few of them. I think it would likely be fine for either hte assembly-symbol (or the compilation) to have such a cache where this is held onto, instead of continaully recreating it :)

@jcouv jcouv added this to the Compiler.Next milestone Jul 14, 2023
@jcouv jcouv added help wanted The issue is "up for grabs" - add a comment if you are interested in working on it and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants