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

GetTypeByMetadataName would benefit greatly from non-alloc optimizations. #68343

Closed
CyrusNajmabadi opened this issue May 26, 2023 · 2 comments · Fixed by #68415
Closed

GetTypeByMetadataName would benefit greatly from non-alloc optimizations. #68343

CyrusNajmabadi opened this issue May 26, 2023 · 2 comments · Fixed by #68415
Assignees
Labels
Area-Compilers Area-Performance Tenet-Performance Regression in measured performance of the product from goals.
Milestone

Comments

@CyrusNajmabadi
Copy link
Member

I'm seeing enormous allocations in GetTypeByMetadataName, exacerbated by how many analyzers that run now that need to look up special types. When typing in Roslyn.sln i see the following for example:

image

This is 600 MB of allocs of strings while just typing a few characters. The core issue here is that we are being fed in large named strings, and continually breaking them into tiny garbage substrings:

image

Moving to an approach where we used ReadOnlyMemory<char> here to refer to sub spans of the string could be greatly beneficial. I'm suggesting ROM over Span here as lots of places where we need these substrings are when looking up into maps currently keyed by strings. Span won't work there given it's ref-struct nature. But ROM would be a viable option there to keep things working.

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

Tagging @jaredpar . Currently the #1 hitter for memory allocs in roslyn. Almost 10% of all allocs during typing is just this :-o

@jcouv
Copy link
Member

jcouv commented May 31, 2023

Assigned to @CyrusNajmabadi since he's already working on a solution. Thanks!

@jcouv jcouv added this to the 17.7 milestone May 31, 2023
@jcouv jcouv added Tenet-Performance Regression in measured performance of the product from goals. Area-Performance and removed untriaged Issues and PRs which have not yet been triaged by a lead labels May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Area-Performance Tenet-Performance Regression in measured performance of the product from goals.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants