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

Reduce boxing allocations of ExtensionMethodInfo in IDE side #69165

Closed
Youssef1313 opened this issue Jul 22, 2023 · 2 comments · Fixed by #69443
Closed

Reduce boxing allocations of ExtensionMethodInfo in IDE side #69165

Youssef1313 opened this issue Jul 22, 2023 · 2 comments · Fixed by #69443
Assignees
Labels
Milestone

Comments

@Youssef1313
Copy link
Member

Found 0.9% boxing allocations of ExtensionMethodInfo. Is there a way to reduce that?

image

@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 22, 2023
@Youssef1313
Copy link
Member Author

I think the fix here is to provide a proper value comparer for the multidictionary.

@arkalyanms arkalyanms removed the untriaged Issues and PRs which have not yet been triaged by a lead label Aug 2, 2023
@arkalyanms arkalyanms added this to the 17.8 P3 milestone Aug 2, 2023
@ToddGrun
Copy link
Contributor

ToddGrun commented Aug 8, 2023

@Youssef1313 -- I'd like to verify the fix I've got locally. Can you share the repro for which you obtained this profile?

ToddGrun added a commit to ToddGrun/roslyn that referenced this issue Aug 9, 2023
Change several structs to record structs such that they no longer are boxed when used as keys in MultiDictionary's internal ImmutableHashSet. When MultiDictionary's value is a struct and is created without specifying the value's IEqualityComparer, the default struct comparer is used. This equality comparer is notoriously slow due to boxing. By switching these structs to record structs, an implementation of IEquatable is generated and the default struct equality comparer isn't used.

Addresses dotnet#69165

Sam mentioned that there is an issue already logged in the roslyn-analyzers repo around adding an analyzer to detect this.

dotnet/roslyn-analyzers#1640
@ToddGrun ToddGrun linked a pull request Aug 9, 2023 that will close this issue
ToddGrun added a commit that referenced this issue Aug 10, 2023
Change several structs to record structs such that they no longer are boxed when used as keys in MultiDictionary's internal ImmutableHashSet. When MultiDictionary's value is a struct and is created without specifying the value's IEqualityComparer, the default struct comparer is used. This equality comparer is notoriously slow due to boxing. By switching these structs to record structs, an implementation of IEquatable is generated and the default struct equality comparer isn't used.

Addresses #69165

Sam mentioned that there is an issue already logged in the roslyn-analyzers repo around adding an analyzer to detect this.

dotnet/roslyn-analyzers#1640
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants