Skip to content

fix: Optimize class chain lookup - #1194

Open
mykola-mokhnach wants to merge 1 commit into
masterfrom
chain-lookup
Open

fix: Optimize class chain lookup#1194
mykola-mokhnach wants to merge 1 commit into
masterfrom
chain-lookup

Conversation

@mykola-mokhnach

Copy link
Copy Markdown

Summary

  • fb_descendantsMatchingClassChain: previously resolved a live XCUIElement (and paid a fresh accessibility round trip) for every indexed segment of a class chain locator, just to obtain a query root for the next segment — expensive for multi-segment indexed chains (e.g. /A[2]//B[3]/C).
  • Replaced the XCUIElementQuery-building approach with a single upfront snapshot of self, walked entirely in memory for type/predicate/position filtering across all segments. A live element is now resolved only once, for the final match(es), via the existing uid-predicate-based fb_filterDescendantsWithSnapshots:onlyChildren: helper.
  • Found and fixed a related correctness pitfall along the way: XCTest's private descendantsByFilteringWithBlock: includes the receiver itself when it matches the filter (unlike XCUIElementQuery's descendantsMatchingType:), so the root snapshot is now explicitly excluded from descendant matches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant