Skip to content

perf(app): mascots stand still while another app has the focus - #162

Merged
httpsphl merged 1 commit into
mainfrom
perf/idle-cpu
Oct 4, 2026
Merged

httpsphl merged 1 commit into
mainfrom
perf/idle-cpu

Conversation

@httpsphl

@httpsphl httpsphl commented Oct 4, 2026

Copy link
Copy Markdown
Owner

The owner saw the WebView at ~14% CPU with no browser open.

Why: the mascots animate forever (flame outline morph, blink and glance on the eyes). While any animation runs, WebView2 produces a frame on every screen refresh (180 Hz here). Measured on the owner's installed app, idle, in the background: GPU process ~1.3 cores + renderer ~1.0.

Fix: while the window is visible but not focused, the mascots and the working trace pause (data-blurred on the root, set from window blur/focus in shell/visibility.ts; paused.css). Spinners, live dots and what arrives keep moving.

Measured (dev app over CDP, idle bots, 10 s per sample):

state WebView CPU
mascots animating ~0.8-1.0 core
flame paused, eyes running ~0.75
mascots paused (this PR, unfocused) ~0.01

Also tried: stepping the flame to ~24 fps (steps()) changed nothing (0.80 vs 0.86), since frames are produced as long as an animation runs; not kept. Spec 15.1 note updated with the numbers.

Test plan

  • pnpm check (focus test in visibility.test.tsx)
  • Measured on the dev app over CDP (table above)
  • Installed app: Task Manager with Botloft open behind another window

The mascots' flames and eyes animate forever, and while any animation
runs the WebView draws a frame on every screen refresh: about one core
with idle bots on a 180 Hz screen. While the window is visible but not
focused, the mascots and the working trace now pause; measured, the
WebView goes from about 1 core to 0.01.
@httpsphl
httpsphl merged commit 8b95c16 into main Oct 4, 2026
4 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