[webkit-changes] [WebKit/WebKit] 912876: AX: Cache accessibilityIsIgnored before in AXIsola...

Tyler Wilcock noreply at github.com
Thu May 25 10:29:03 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9128760a1c6a839c8cb022f19e2a41cd842791d4
      https://github.com/WebKit/WebKit/commit/9128760a1c6a839c8cb022f19e2a41cd842791d4
  Author: Tyler Wilcock <tyler_w at apple.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M Source/WebCore/accessibility/AXObjectCache.cpp
    M Source/WebCore/accessibility/AXObjectCache.h
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp

  Log Message:
  -----------
  AX: Cache accessibilityIsIgnored before in AXIsolatedTree::generateSubtree and AXIsolatedTree::updateChildren
https://bugs.webkit.org/show_bug.cgi?id=244724
rdar://problem/99501850

Reviewed by Andres Gonzalez.

We do a lot of reading from the live tree in AXIsolatedTree::generateSubtree
and AXIsolatedTree::updateChildren, especially during large updates.
This often involves repeated computation of accessibilityIsIgnored for
the same elements, which is expensive. This patch deploys AXAttributeCacheEnabler in both of
these codepaths.

This patch also fixes AXAttributeCacheEnabler to not disable the AXComputedObjectAttributeCache
if it existed before AXAttributeCacheEnabler was constructed. This prevents nested calls
to AXAttributeCacheEnabler from disabling the cache prematurely. Concretely, without this
change, we would construct an AXAttributeCacheEnabler in AXIsolatedTree::updateChildren,
then overwrite that cache with the AXAttributeCacheEnabler in AccessibilityObject::updateChildrenIfNecessary(),
then destroy that new cache when updateChildrenIfNecessary ends, making the initial cache
from AXIsolatedTree::updateChildren useless.

In a sample taken from Quip with 130k total samples, this eliminates 20k samples.

* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXAttributeCacheEnabler::AXAttributeCacheEnabler):
(WebCore::AXAttributeCacheEnabler::~AXAttributeCacheEnabler):
* Source/WebCore/accessibility/AXObjectCache.h:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::generateSubtree):
(WebCore::AXIsolatedTree::updateChildren):

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




More information about the webkit-changes mailing list