Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c976b42339408e0d64e484208f62fac9e9489e5e
      
https://github.com/WebKit/WebKit/commit/c976b42339408e0d64e484208f62fac9e9489e5e
  Author: Tyler Wilcock <[email protected]>
  Date:   2025-09-02 (Tue, 02 Sep 2025)

  Changed paths:
    M Source/WebCore/accessibility/AXCoreObject.cpp

  Log Message:
  -----------
  AX: When computing AXCoreObject::unignoredChildren, we re-retrieve the same 
parent object numerous times (sometimes thousands of times), hurting performance
https://bugs.webkit.org/show_bug.cgi?id=298251
rdar://159684099

Reviewed by Joshua Hoffman.

One "phase" of computing AXCoreObject::unignoredChildren is iterating through 
the siblings of an object to find one that
is eligible. It's a bit more complicated than that, as nextInPreOrder may cause 
us to go down a level in the tree, but
often we iterate through siblings at the same level hundreds or thousands of 
times. Prior to this commit, this sibling
iteration happened by calling AXCoreObject::nextSiblingIncludedIgnored(), which 
re-retrieved the parent object every time.
This has costs — chasing a pointer to the object's AXIsolatedTree, member 
variable read to get the parent ID, a hashmap
lookup in the tree, and a +1 and -1 ref-count churn. With a function as hot as 
unignoredChildren, this is a gigantic cost.

This commit "inlines" the relevant bits of 
AXCoreObject::nextSiblingIncludedIgnored into AXCoreObject::unignoredChildren,
allowing us to implement a mechanism that caches a descendant's parent and 
siblings.

I took a sample before and after this change with 90 seconds of VoiceOver 
navigation on html.spec.whatwg.org:

Before: 10210 samples spent in AXCoreObject::unignoredChildren
After: 4641 samples spent in AXCoreObject::unignoredChildren

* Source/WebCore/accessibility/AXCoreObject.cpp:
(WebCore::AXCoreObject::unignoredChildren):
* Source/WebCore/accessibility/AXCoreObject.h:

Canonical link: https://commits.webkit.org/299474@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to