Skip to content

v1.0.8 — throttle a11y tree walks to fix frame-rate drop#12

Merged
undisputedP merged 1 commit into
mainfrom
claude/v1.0.8-throttle-walks
May 9, 2026
Merged

v1.0.8 — throttle a11y tree walks to fix frame-rate drop#12
undisputedP merged 1 commit into
mainfrom
claude/v1.0.8-throttle-walks

Conversation

@undisputedP
Copy link
Copy Markdown
Owner

Why

User reports visible frame-rate drop on YouTube while v1.0.7's accessibility service is active. Cause is well-defined: YouTube emits `TYPE_WINDOW_CONTENT_CHANGED` at ~30 Hz during normal scrolling, and v1.0.7 ran a full 1200-node tree walk on every event. ~36k node inspections per second while scrolling is enough to bust the 16ms frame budget.

Fix

  1. Throttle content-changed walks to ~4×/sec (250ms minimum interval). Detection latency on Shorts open is unaffected because state-changed events bypass the throttle — those are rare, fire on real screen transitions, and are how Shorts entry presents.
  2. Halve MAX_NODES_PER_WALK (1200 → 600). The Shorts UI lives in the first few hundred nodes; the rest was safety margin.

Steady-state CPU during YouTube use drops to roughly 1/15th of v1.0.7. Strict-class detection rules are unchanged.

Test plan

  • CI green
  • Install `v1.0.8.apk`, accessibility permission stays granted
  • Scroll YouTube home feed — frame rate should feel normal again
  • Open a Short — should still bounce out within ~600ms (state-change → immediate walk)
  • Debug card after a Short is dismissed: `STRONG: ids/strictCls` should show non-zero

User reported visible frame-rate drop while scrolling YouTube with
the accessibility service active. Cause: YouTube fires
TYPE_WINDOW_CONTENT_CHANGED at ~30 Hz during scroll, and v1.0.7 ran
the full 1200-node tree walk on every event. That's ~36k node
inspections per second while scrolling — enough to push the system
past the 16ms frame budget.

Two changes:

1. Throttle walks for content-changed events to one every 250ms.
   State-changed events (rare; fire when entering Shorts /
   navigating screens) keep being processed immediately so detection
   latency on the path that matters is unchanged.

2. Reduce MAX_NODES_PER_WALK from 1200 to 600. Empirically the
   relevant Shorts UI lives in the first few hundred nodes; the
   1200 cap was just safety margin we don't need.

Net effect for the user: while on YouTube home / scrolling the
feed, we walk ~4×/sec instead of ~30×/sec, and each walk visits
half as many nodes. Total CPU work in the steady state is about
1/15th of v1.0.7. Detection on Shorts open is unaffected since
that triggers a STATE_CHANGED event which still walks immediately.

Bump versionCode 8 → 9, versionName 1.0.7 → 1.0.8.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@undisputedP undisputedP merged commit 2f6a068 into main May 9, 2026
2 checks passed
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