Bug 250234

Summary: AX: Do not re-create the entire relations map every time a relation attribute changes.
Product: WebKit Reporter: Andres Gonzalez <andresg_22>
Component: AccessibilityAssignee: Andres Gonzalez <andresg_22>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, andresg_22, apinheiro, cfleizach, dmazzoni, ews-watchlist, jcraig, jdiggs, samuel_white, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Andres Gonzalez 2023-01-06 14:37:18 PST
This may have a significant performance impact.
Comment 1 Radar WebKit Bug Importer 2023-01-06 14:37:30 PST
<rdar://problem/103968374>
Comment 2 Andres Gonzalez 2023-01-06 14:42:01 PST
Created attachment 464382 [details]
Patch
Comment 3 Andres Gonzalez 2023-01-09 14:45:26 PST
Created attachment 464426 [details]
Patch
Comment 4 Andres Gonzalez 2023-01-10 18:07:07 PST
Created attachment 464451 [details]
Patch
Comment 5 chris fleizach 2023-01-10 22:58:16 PST
Comment on attachment 464451 [details]
Patch

thanks Andres!
Comment 6 chris fleizach 2023-01-10 22:59:19 PST
Comment on attachment 464451 [details]
Patch

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

> Source/WebCore/accessibility/AXObjectCache.cpp:4083
> +    for (AXID targetID : targetIDs)

this could be
auto targetID : targetIDs

> Source/WebCore/accessibility/AXObjectCache.cpp:4156
> +    for (size_t i = 0; i < ids.size(); ++i) {

you could store ids.size() outside the loop so it doesn't have to be called each time in the loop
Comment 7 Andres Gonzalez 2023-01-11 05:52:53 PST
(In reply to chris fleizach from comment #6)
> Comment on attachment 464451 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=464451&action=review
> 
> > Source/WebCore/accessibility/AXObjectCache.cpp:4083
> > +    for (AXID targetID : targetIDs)
> 
> this could be
> auto targetID : targetIDs
> 
> > Source/WebCore/accessibility/AXObjectCache.cpp:4156
> > +    for (size_t i = 0; i < ids.size(); ++i) {
> 
> you could store ids.size() outside the loop so it doesn't have to be called
> each time in the loop

It is an inline for Vector and most std-like collections, so there is no harm. Thanks!
Comment 8 Andres Gonzalez 2023-01-11 16:45:29 PST
Created attachment 464459 [details]
Patch
Comment 9 EWS 2023-01-11 19:05:47 PST
Committed 258816@main (278013ba2274): <https://commits.webkit.org/258816@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 464459 [details].