-
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
Optimize syntactic classification walk #73629
Optimize syntactic classification walk #73629
Conversation
// sorting the results before doing anything with them. | ||
foreach (var child in current.ChildNodesAndTokens()) | ||
{ | ||
if (child.IsNode) |
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 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.
If possible, I would prefer it be called IsNode(out SyntaxNode?)
. I don't think this is possible with a property and method in the same type, but may be possible with it defined as an extension method.
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.
I didn't know the AsNode method existed. Will update to that.
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.
done.
if (child.IsNode) | ||
{ | ||
var childNode = child.AsNode()!; | ||
if (childNode.FullSpan.IntersectsWith(_textSpan)) |
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 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.
I'll def try that
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.
done
|
||
// It's ok that we're not pushing in reverse. The caller (TotalClassificationTaggerProvider) will be | ||
// sorting the results before doing anything with them. | ||
foreach (var child in current.ChildNodesAndTokens()) |
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.
this is way off topic, but I took another look at the SyntaxList.Enumerator's call to ItemInternal, and I'm not clear why the slotIndex isn't held between calls. By not doing so, the first loop in ItemInternal would need to walk the green slots until it reaches the appropriate slot index.
Again, off topic, so nothing needed in this PR, but it seems odd.
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.
def look into that. there are some comments explaining things. but it's possible they're stale, or there is room for improvement here.
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.
Note: i'm saying @ToddGrun should look into this :)
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.
Drops us about 0.7% during scrolling from:
to