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

Use discarded use site info to avoid unnecessary expensive work #67934

Closed
wants to merge 1 commit into from

Conversation

Youssef1313
Copy link
Member

Probably helps with #67926 ?

My analysis is that GetUseSiteInfo is showing as expensive

image

The scenario is IDE completion where the IDE calls LookupSymbols here:

_context.SemanticModel.LookupSymbols(position, container, includeReducedExtensionMethods: true));

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 the GetUseSiteInfo calls happening here:

var info = symbol.GetUseSiteInfo();

by getting into this code path when appropriate:

if (!useSiteInfo.AccumulatesDiagnostics)
{
Debug.Assert(!useSiteInfo.AccumulatesDependencies);
return;
}

Assuming this change is reasonable and correct, I'd still like someone confirm whether this is the root cause of #67926 or not.

@Youssef1313 Youssef1313 requested a review from a team as a code owner April 23, 2023 10:09
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 23, 2023
@ghost ghost added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Apr 23, 2023
@Youssef1313
Copy link
Member Author

There are assertion failures, the change might not be correct then :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Community The pull request was submitted by a contributor who is not a Microsoft employee. untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant