Skip to content

perf: screen reader queries#3674

Merged
isekovanic merged 3 commits into
developfrom
perf/screen-reader-queries
Jun 22, 2026
Merged

perf: screen reader queries#3674
isekovanic merged 3 commits into
developfrom
perf/screen-reader-queries

Conversation

@isekovanic

@isekovanic isekovanic commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

🎯 Goal

useScreenReaderEnabled used to attach its own AccessibilityInfo listener and fire its own isScreenReaderEnabled() native query on every mount. It runs in every Message row (twice, via useMessageActionHandlers) plus the composer, so the app requeried the OS and resubscribed on every row mount/remount - work that grows with message count and scrolling.

This PR introduces a single app-wide ScreenReaderContext: one provider performs one query + one listener, and every consumer reads the value from context. useScreenReaderEnabled collapses to a context read; its public signature and the enabled / forceScreenReaderMode gating are unchanged.

On-device perf-testing tooling (initial pass WIP)

In addition to all of this, the PR also introduces a bootstrapping on device perf testing setup we'll keep iterating on. It's in its early conception still, but so far it's been able to run its own iteration over our SampleApp (on Android) and add performance related probes so as to measure this particular change. The result was ~300 microseconds less work for each message to render (asynchronous, of course, non blocking for the UI, but still). This work is of course hugely negligible and will never matter in the grand scheme of things (especially for something gated behind a flag like a11y), but it's still very interesting that it is able to find this out on a fresh agent, with almost no interaction from my side (after many, many iterations :D ). It comes with its own "verbs" (rudimentary for now) related to app actions and only works with ADB. Later own we'll extend this further and potentially add iOS support as well.

Features so far:

  • perf/scenario-lib.sh — reusable adb/uiautomator device-driving verbs (wait-on-testID, tap, retry tap, scroll, count).
  • perf/scenario-template.sh + perf/drive-channel-scenario.sh - template + first scenario.
  • A perf-benchmarking skill capturing the methodology and pitfalls, containing some instructions on how to actually do actionable things in the app

A more proper technical document for this will be included later.

🛠 Implementation details

🎨 UI Changes

iOS
Before After
Android
Before After

🧪 Testing

☑️ Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • Documentation is updated
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

@isekovanic isekovanic requested review from oliverlaz and szuperaz June 22, 2026 17:33
@Stream-SDK-Bot

Copy link
Copy Markdown
Contributor

SDK Size

title develop branch diff status
js_bundle_size 1957 KB 1959 KB +1817 B 🔴

@isekovanic isekovanic merged commit f397332 into develop Jun 22, 2026
10 of 11 checks passed
@isekovanic isekovanic deleted the perf/screen-reader-queries branch June 22, 2026 17:40
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.

3 participants