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

Reduce time spent in ConflictResolver.Session.GetNodesOrTokensToCheckForConflicts #74101

Merged
merged 3 commits into from
Jun 25, 2024

Conversation

ToddGrun
Copy link
Contributor

This method previoulsy realized/walked the whole tree to try to find annotations to search for in it's AnnotationTable. Instead, use the GetAnnotatedNodesAndTokens to limit the search to only those areas of the tree that contain annotations.

This showed up in a profile I took of a lightbulb session which showed the preview window.

…ForConflicts

This method previoulsy realized/walked the whole tree to try to find annotations to search for in it's AnnotationTable. Instead, use the GetAnnotatedNodesAndTokens to limit the search to only those areas of the tree that contain annotations.

This showed up in a profile I took of a lightbulb session which showed the preview window.
@ToddGrun ToddGrun requested a review from a team as a code owner June 21, 2024 14:42
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jun 21, 2024
{
foreach (var lambda in lambdas)
if (_conflictLocations.Any(cf => cf.Contains(lambda.Span)))
Copy link
Member

Choose a reason for hiding this comment

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

no 'any' that takes an arg?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There isn't one available, and the only current extension methods we have on ImmutableHashSet are in the compiler, and I didn't want to change that in this PR.

@@ -159,15 +159,12 @@ public RenameRewriter(RenameRewriterParameters parameters)

var isInConflictLambdaBody = false;
var lambdas = node.GetAncestorsOrThis(n => n is SimpleLambdaExpressionSyntax or ParenthesizedLambdaExpressionSyntax);
if (lambdas.Count() != 0)
Copy link
Member

Choose a reason for hiding this comment

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

YIKES

@@ -505,9 +505,13 @@ private async Task DebugVerifyNoErrorsAsync(MutableConflictResolution conflictRe
private IEnumerable<(SyntaxNodeOrToken syntax, RenameActionAnnotation annotation)> GetNodesOrTokensToCheckForConflicts(
SyntaxNode syntaxRoot)
{
return syntaxRoot.DescendantNodesAndTokens(descendIntoTrivia: true)
Copy link
Member

Choose a reason for hiding this comment

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

YIKES

@ToddGrun ToddGrun merged commit e79b9b5 into dotnet:main Jun 25, 2024
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jun 25, 2024
@RikkiGibson RikkiGibson modified the milestones: Next, 17.12 P1 Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE 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.

3 participants