Reduce allocations in AbstractRecommendationServiceBasedCompletionProvider.GetSymbolsAsync #76365
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This method accounts for about 3% of VS allocations during the typing scenario in the csharp editing scrolling speedometer test.
Move the comparer from the Contains call to the Set creation. By having this on the Contains call, the code was actually invoking the Linq overload of contains, fully walking the collection (and creating an enumerator to do so) instead of treating it like a set.
Moved the IsIntrinsic call before the InferredTypes check as it is cheap
Don't invoke the GetSymbolType method if the inferredTypes array is empty.
It's unclear exactly how much gain this will get, but I saw the inferredTypes collection empty often enough that I am expecting somewhere between a 1% and 2% reduction from this.
*** Relevant allocations from speedometer test without this change ***
