Use discarded use site info to avoid unnecessary expensive work #67934
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.
Probably helps with #67926 ?
My analysis is that
GetUseSiteInfo
is showing as expensiveThe scenario is IDE completion where the IDE calls
LookupSymbols
here:roslyn/src/Workspaces/Core/Portable/Recommendations/AbstractRecommendationServiceRunner.cs
Line 393 in ef625f3
So this scenario should mostly be using discarded diagnostics. My hypothesis is that we create non-discarded use site info to later add it in a discarded diagnostic bag, so my thought is that when we use non-discarded use site info, we call
GetUseSiteInfo
unnecessarily in some cases. So this PR aims to reduce theGetUseSiteInfo
calls happening here:roslyn/src/Compilers/CSharp/Portable/Symbols/SymbolExtensions.cs
Line 110 in ef625f3
by getting into this code path when appropriate:
roslyn/src/Compilers/CSharp/Portable/Symbols/SymbolExtensions.cs
Lines 104 to 108 in ef625f3
Assuming this change is reasonable and correct, I'd still like someone confirm whether this is the root cause of #67926 or not.