Repository navigation
perf(app): mascots stand still while another app has the focus - #162
Merged
Merged
Conversation
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.
2 of 3 tasks
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.
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-blurredon the root, set from windowblur/focusinshell/visibility.ts;paused.css). Spinners, live dots and what arrives keep moving.Measured (dev app over CDP, idle bots, 10 s per sample):
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 invisibility.test.tsx)