Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 56d65459b823771b022695053f05ce1bfb7b286d
      
https://github.com/WebKit/WebKit/commit/56d65459b823771b022695053f05ce1bfb7b286d
  Author: Tyler Wilcock <[email protected]>
  Date:   2025-02-22 (Sat, 22 Feb 2025)

  Changed paths:
    M Source/WebCore/accessibility/AXCoreObject.cpp
    M Source/WebCore/accessibility/AXCoreObject.h
    M Source/WebCore/accessibility/AXSearchManager.cpp
    M Source/WebCore/accessibility/AXTextMarker.cpp
    M Source/WebCore/accessibility/AccessibilityObject.h
    M Source/WebCore/accessibility/AccessibilityRenderObject.cpp
    M Source/WebCore/accessibility/AccessibilityScrollView.cpp
    M Source/WebCore/accessibility/atspi/AccessibilityObjectComponentAtspi.cpp
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h
    M Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

  Log Message:
  -----------
  AX: Stop calling updateBackingStore() in AXIsolatedObject::children() for 
performance reasons
https://bugs.webkit.org/show_bug.cgi?id=287862
rdar://145062082

Reviewed by Chris Fleizach.

AXIsolatedObject::updateBackingStore() calls 
AXIsolatedTree::applyPendingChanges(), which takes a lock. This is not
ideal to use in a function that is as hot as AXIsolatedObject::children(). 
Calling updateBackingStore() also requires
a strong-ref and strong-deref to |this| in the function, since 
updateBackingStore() can delete |this|. These refs
and derefs, and updateBackingStore show up in samples taken on a popular video 
website.

With this commit, we remove the call to updateBackingStore in 
AXIsolatedObject::children. We really should only need
to call updateBackingStore once for every attribute request, and should do so 
right at the beginning of the attribute
request in the wrapper. This may also be a bit more logical, ensuring each 
attribute request is served from the same
snapshot of the tree.

This patch also features several unrelated performance improvements:
  - Remove updateChildrenIfNecessary from AXIsolatedObject. It's a
    no-op, but we still incur the cost of a virtual function call in our
    hottest codepaths (e.g. nextInPreOrder).
  - Remove unnecessary ref-churn, e.g. creating a Ref just to call Vector::find.
  - Inline isValid() and isInTextRun() in AXTextMarker::findMarker, our
    hottest text marker function.
  - Reduce unnecessary calls to AXTextMarker::runs().

All of these things showed up significantly in samples.

* Source/WebCore/accessibility/AXCoreObject.cpp:
(WebCore::AXCoreObject::nextInPreOrder):
(WebCore::AXCoreObject::previousInPreOrder):
(WebCore::AXCoreObject::nextSiblingIncludingIgnored const):
(WebCore::AXCoreObject::previousSiblingIncludingIgnored):
(WebCore::AXCoreObject::nextUnignoredSibling const):
* Source/WebCore/accessibility/AXCoreObject.h:
* Source/WebCore/accessibility/AXSearchManager.cpp:
(WebCore::appendAccessibilityObject):
(WebCore::appendChildrenToArray):
* Source/WebCore/accessibility/AXTextMarker.cpp:
(WebCore::AXTextMarker::findMarker const):
* Source/WebCore/accessibility/AccessibilityObject.h:
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::addNodeOnlyChildren):
* Source/WebCore/accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::removeChildScrollbar):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::children):
(WebCore::AXIsolatedObject::updateChildrenIfNecessary): Deleted.
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h:
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper 
_accessibilityHitTest:returnPlatformElements:]):

Canonical link: https://commits.webkit.org/290904@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