Skip to content

Conversation

@ToddGrun
Copy link
Contributor

@ToddGrun ToddGrun commented Aug 6, 2025

This method usually accounts for ~1% of allocations in the Roslyn CodeAnalysis process during completion scenarios in the CompletionInCohosting Razor speedometer test.

Razor uses this method from a couple disparate locations (mostly around detecting taghelpers and components). This PR changes the cached InterfaceInfo to keep an IA for the public symbols in addition to the internal symbols, as razor requests the public symbols multiple times.

Test insertion: https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/659529

The speedometer test seems to have a high amount of variance in allocations, but before this change usually sat around 1% of allocations in the profiles under this callstack. After this change, that number sits more around 0.6%.

*** Before ***
image

*** After ***
image
and
image

This method accounts for 2.0% of allocations during completion in the CompletionInCohosting Razor speedometer test.

Razor uses this method from a couple disparate locations (mostly around detecting taghelpers and components). I've verified locally that about 2/3 of these allocations can be removed by having the InterfaceInfo cache the public symbol array information too.
@ToddGrun ToddGrun changed the title *** WIP: Reduce allocations from calling ITypeSymbol.AllInterfaces Reduce allocations from calling ITypeSymbol.AllInterfaces Aug 7, 2025
@ToddGrun ToddGrun marked this pull request as ready for review August 7, 2025 13:16
@ToddGrun ToddGrun requested a review from a team as a code owner August 7, 2025 13:16
@ToddGrun
Copy link
Contributor Author

@dotnet/roslyn-compiler -- ptal

@AlekseyTs
Copy link
Contributor

Done with review pass (commit 1)

Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

@dotnet/roslyn-compiler for a second review.

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

LGTM (commit 3)

@ToddGrun ToddGrun merged commit bf37f11 into dotnet:main Aug 28, 2025
24 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Aug 28, 2025
@akhera99 akhera99 modified the milestones: Next, 18.0 P1, 18.0 P2 Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants