Skip to content

Conversation

@ToddGrun
Copy link
Contributor

@ToddGrun ToddGrun commented Nov 18, 2025

AbstractInlineHintService currently retrieves two intermediate arrays from the type and parameter services and then joins them together and returns the resultant array. Instead, pass an ArrayBuilder to the type and parameter services and have them populate it directly, and then only allocate a single IA from the ArrayBuilder.

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

This previously showed as 4.5% (5.0 MB) of RoslynCodeAnalysisService allocations in the html completion scenario in the RazorEditingTests.CompletionInCohosting speedometer test. With this change, allocations of the InlineHint[] went down to 1.8% (2.1 MB)

*** BEFORE ***
image

*** AFTER (roslyn symbols didn't load for some reason) ***
image

AbstractInlineHintService retrieves two intermediate arraysfrom the type and parameter services and then joins them together and returns the resultant array. Instead, pass an ArrayBuilder to the type and parameter services and have them populate it directly, and then only allocate a single IA from the ArrayBuilder.
@ToddGrun ToddGrun marked this pull request as ready for review November 18, 2025 14:41
@ToddGrun ToddGrun requested a review from a team as a code owner November 18, 2025 14:41
…NameHintsService.cs

Co-authored-by: Cyrus Najmabadi <cyrus.najmabadi@gmail.com>
@ToddGrun ToddGrun merged commit 32d743d into dotnet:main Nov 18, 2025
26 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Nov 18, 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.

2 participants