Skip to content

perf(mobile): suspend hidden-screen polling and clocks - #636

Merged
nixuuu merged 1 commit into
devfrom
perf/mobile-idle-work
Nov 13, 2026
Merged

nixuuu merged 1 commit into
devfrom
perf/mobile-idle-work

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

A retained thread panel continued GetThreadPanel polling every five seconds while the app was backgrounded. Covered native-stack screens also retained clocks and decorations. Scope recurring work to foreground screen visibility, share countdown ticks, and cancel diagnostics uploads on suspension. A pure-TS lifecycle regression guard covers suspension, resumption, duplicate activity events and teardown.

Fixes: #559

Related: #629

Instrumented path Before After
Visible thread panel, recurring reads/min 12 12
Background/covered thread panel, recurring reads/min 12 0
20 mounted request countdowns, foreground timers 20 1
Same countdowns, background timers 20 0

Method: temporary hook instrumentation outside the repository, executing the production query cache and hooks with a simulated 120-second clock. These are timer/request counts, not native CPU, FPS, React render rates, hardware wakeups or battery measurements. No conversation payloads were captured.

Native profiling is blocked: T3 Device list and open report Could not communicate with device support. Try refreshing devices. Refreshing once did not recover the service. SSH profiling was available, but Android was in DevLauncherErrorActivity with zero recorded app frames. Its 0.2% process CPU is therefore excluded as an invalid Canopy baseline. iOS's installed process was at 0.0% in ps, also without a verified scenario. No native before/after claim is made.

Requested native scenario, both platforms CPU / JS+UI FPS / renders/s / wakeups / requests per minute
Thread list with 2+ Working threads Unavailable before and after
Streaming thread Unavailable before and after
Idle open thread Unavailable before and after
PR panel Unavailable before and after
List idle for two minutes Unavailable before and after

Inspection found UI/native-thread animation loops, stable list keys, memoized timeline/tree rows, and the existing shared status-label clock. The warmer remains bounded to one request at a time and at most 12 starts/min; unchanged heads do not schedule reads. No hot-message log spam or animated backdrop blur was found. The 24-slice text shimmer and continuous composer geometry sampling still need a native GPU/layout profile. This PR only suspends those paths when hidden/backgrounded; it does not claim to eliminate foreground heating.

Validation uses nice -n 10: install, gen:check, typecheck, repository lint, format:check and web build passed. The focused lifecycle regression test passed. Both native JS/Hermes exports passed (approximately 12 MB each). Full check:tmp passed on the combined changes: 2,749 passed, 166 skipped, zero failures, and nothing left in the checked temp directory. All CI checks passed at this head. Expo ESLint has pre-existing findings: isolated dev baseline 82 errors, changed tree 79, with no new file/rule errors. No UI suites, EAS builds, release builds, publications or native dependency changes.

Native fingerprints are unchanged in the same local stable config:

  • iOS: 74705db3a68907bc28379bb9b1080a227bc0755b
  • Android: 7d38be8f5c9bf842d62060c75820a206f99c87e3

UI copy is unchanged. Native visual verification remains blocked by device support.

A retained thread panel kept polling every five seconds while the app was suspended. Scope clocks, decorative loops and recurring reads to screen visibility and foreground activity; share countdown ticks and cancel diagnostics uploads on suspension.

Fixes: #559

Related: #629
@nixuuu
nixuuu marked this pull request as ready for review November 13, 2026 11:49
@nixuuu
nixuuu merged commit 7a25d84 into dev Nov 13, 2026
12 checks passed
@nixuuu
nixuuu deleted the perf/mobile-idle-work branch November 13, 2026 12:01
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