-
Notifications
You must be signed in to change notification settings - Fork 229
Description
This method shows up in a bunch of telemetry data as being problematic:
https://prism.vsdata.io/failuregroup/?query=ch%3Drelease%20r%3D17.6&eventType=cpu&failureType=dualdirection&failureGroupId=8ce2951e-a750-4c08-9319-fa7ab9c25aca
It's only called in about half a dozen places in tooling, so we should see if we can write a better version that doesn't do so much tree traversal. At a quick look, it is recursing all the way down the tree into every child node, then checking if the node is the previous one to the original. Flipping that, and only traversing down once it has found the previous sibling should save a bunch of work for the same result. For some uses, that level of traversal may even be unnecessary, and given only a few calls, its not unreasonable to examine each one.
More discussion, internally, in https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1828376