+8
−0
+37
−0
Loading
ForEachAncestorObserver walks the inclusive ancestor chain on every mutation, which is O(depth). To improve performance, nsINode memoizes one walk's start node and the lowest ancestor found to hold an observer, and a later walk from the same node starts there. The memo only picks where a walk starts, never what it returns. It is dropped when an observer is registered anywhere, or when certain mutations occur. Testcase goes 8346 -> 2342 samples, with the walk down from 53% to 0.8%. Speedometer3 is neutral. mach try auto is clean. Differential Revision: https://phabricator.services.mozilla.com/D314591