-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Reduce time spent in ConflictResolver.Session.GetNodesOrTokensToCheckForConflicts #74101
Conversation
…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.
{ | ||
foreach (var lambda in lambdas) | ||
if (_conflictLocations.Any(cf => cf.Contains(lambda.Span))) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YIKES
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.