[webkit-reviews] review granted: [Bug 211078] Improve performance of commonInclusiveAncestor for deeply nested nodes : [Attachment 397686] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 27 09:06:16 PDT 2020


Antti Koivisto <koivisto at iki.fi> has granted Darin Adler <darin at apple.com>'s
request for review:
Bug 211078: Improve performance of commonInclusiveAncestor for deeply nested
nodes
https://bugs.webkit.org/show_bug.cgi?id=211078

Attachment 397686: Patch

https://bugs.webkit.org/attachment.cgi?id=397686&action=review




--- Comment #5 from Antti Koivisto <koivisto at iki.fi> ---
Comment on attachment 397686
  --> https://bugs.webkit.org/attachment.cgi?id=397686
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=397686&action=review

findNearestCommonComposedAncestor has another implementation using a HashSet.
Yours is probably better since it avoids allocation and hashing even if it
requires more traversal.

> Source/WebCore/dom/Node.cpp:2627
> +    auto [depthA, depthB] = std::make_tuple(depth(a), depth(b));
> +    auto [x, y, difference] = depthA > depthB

Interesting use of temporary tuples.


More information about the webkit-reviews mailing list