perf(native): use index queues for AX BFS#485
Closed
JustYannicc wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Array.removeFirst()queue consumption in the native Accessibility BFS loops with monotonic index cursors.scripts/bench-ax-bfs-queue.swiftso the queue behavior benchmark is repeatable.Why
Accessibility selected-text and caret lookup run on hot paths.
Array.removeFirst()shifts/copies the remaining queue on every pop, even though these traversals only need FIFO order and already cap depth/element counts.Behavior and compatibility
Evidence
removeFirst: 235.47 ms,cursor: 37.95 ms, equal checksum,6.20xspeedup.swift -O scripts/bench-ax-bfs-queue.swift->removeFirst: 211.29 ms,cursor: 36.80 ms, equal checksum,5.74xspeedup.src/native/ax-caret-query.swift,src/native/get-selected-text.swift, andscripts/bench-ax-bfs-queue.swift.swiftc -O -o /tmp/supercmd-get-selected-text-check src/native/get-selected-text.swift -framework Foundation -framework ApplicationServices -framework AppKit.swiftc -O -o /tmp/supercmd-emoji-trigger-monitor-check src/native/emoji-trigger-monitor.swift src/native/ax-caret-query.swift -framework AppKit -framework ApplicationServices.node --test 'scripts/test-*.mjs'passed: 24 passed, 1 skipped.node scripts/check-i18n.mjsexited 0; it reports pre-existing Italian locale gaps unrelated to this native-only change.Risk
Low. The traversal queue still appends in the same order and stops at the same caps; the only intentional change is avoiding per-pop array shifting.