Repository navigation
perf(ui): distinguish settled idle from hidden transition work - #194095
Conversation
…u-round2-1106 # Conflicts: # scripts/bench-control-ui-engines.ts
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ddd4af71bd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (isEngineIdleScenario(scenario) && idleWarmupMs > 0) { | ||
| await new Promise<void>((resolve) => { | ||
| setTimeout(resolve, idleWarmupMs); | ||
| }); | ||
| } |
There was a problem hiding this comment.
Reset page-observer metrics after the idle warmup
For hidden-idle scenarios using the new default warmup, resetControlUiPageObserver(page) still runs before hiding and before this 60-second wait, while finishControlUiPageObserver(page) runs after measurement. Consequently, pageMetrics.longTaskCount, longTaskTotalMs, longestLongTaskMs, and layout-shift metrics include the transition and warmup even though CPU and resource deltas exclude them. These values are carried into the benchmark summaries, so a reclamation burst during settling can still appear as a settled-idle long task. Reset the page observer after warmup, alongside the other measurement boundaries.
Useful? React with 👍 / 👎.
|
Merged via squash auto-merge.
|
…law#194095) * perf(ui): validate settled idle and rotate session rings * fix(bench): check idle clock recovery at displayed precision * perf(ui): retain idle benchmark corrections after animation trial
What Problem This Solves
The idle benchmark reported initial hidden-tab reclamation as sustained CPU use and did not balance bundle order correctly.
User Impact
There is no user-visible UI change. Developers can distinguish steady hidden idle from the hide transition and attribute visible work with 0/1/5/20-running-row fixtures.
Why This Change Was Made
Hidden idle now defaults to a 60-second settling period;
--idle-warmup-ms 0deliberately measures the transition. Blank/static controls avoid loading the app or Gateway. Outbound RPC accounting stops before reveal/recovery, resource callbacks retain their own elapsed interval, clock recovery uses the formatter’s displayed precision, and bundle order is rotated once.No production animation change remains. The individual-rotation candidate avoided most WebKit paint records but failed the required CPU/style-time improvement, so it was rejected. Existing motion, reduced-motion behavior, styles, and startup assets are unchanged. No size ceilings were raised.
Evidence
All measurements below use a verified production build of base
b11b610d173cc6ff87eb026b6506c20fc7e5fd62(#193998). An earlier stale copied bundle was detected and its comparisons discarded. Runs were serial, headless, synthetic, and connected; no live Gateway/provider claim is made.These diagnostic cells all had zero style/layout work, rAF and observer callbacks. The app remained natively hidden and connected; first/last clock recovery passed after reveal and scroll. No outbound mock RPCs occurred in the measured window; the fixture still emits an incoming tick every 30 seconds. In a separate fresh-hide native trace, the app used 869.498 ms CPU/min versus 24.204/24.281 for controls and recorded two major GCs with 363.052 ms of main-thread GC elapsed spans. GC elapsed time and thread CPU are different clocks and are not subtracted or used to claim an exact CPU share. Fresh and settled runs also differ in profiling instrumentation. The result supports an initial reclamation burst, not sustained hidden work. WebKit has no supported native-hidden API in this harness.
Visible attribution below is diagnostic n=1 per cell, not acceptance evidence. The same expanded 200-child tree contained 1/5/20 visible running children.
The marginal diagnostic cost per additional row was about 49–58 ms CPU/min at Chromium 1× and 256–401 at 6×; this is not an independent constant per ring. The first ring activates most of the shared per-frame cost. Native traces had about 1,804 style/commit cycles per 30 seconds for either 1 or 20 rings, restyling exactly 1 or 20 elements, not the whole tree. Layers at 0/1/5/20 rings were 11/13/21/51. Top-level rows are windowed; expanded children stay mounted.
Pausing rings left Chromium 1× at 283.69/292.28/358.81 ms CPU/min and WebKit at 3.28/4.17/6.36 ms style elapsed/min. Also pausing the shared one-second clock source left Chromium 1× at 43.97/48.62/46.46. The shared source affects all its consumers; the ablations are non-additive and do not isolate a constant elapsed-label cost. Chromium 1× attribution is profiled while 6× is CPU-only; their ratio is not a device-scaling measurement. WebKit durations are elapsed category time, not CPU or a fraction of a core.
The rejected animation candidate was measured with 20 rotated base/candidate/base triples per engine, 30-second windows after 5-second warmup, one engine/config/profile/viewport/scenario per stage. Each stage passed all 60 observations with 20 visible running rows and balanced positions. A/A uses the second identical base bundle.
WebKit paint records fell from median 72,170 to 90 per 30 seconds (A/A: 72,130), but style time did not improve. Ratios above compare bundle distribution medians, not medians of pairwise ratios. Host-load samples accompany the retained local evidence; Chromium 1× load1 ranged 2.85–18.30. A copied-bundle 30 Hz diagnostic reduced CPU/style by about 40% at n=1, but changes temporal sampling and was not proven imperceptible, so it was not selected. No one-row acceptance guard or actual-source phase screenshot proof is claimed for the rejected candidate.
Verdicts: settled hidden Chromium is near the control floor, with correct clock catch-up. Visible cost is ring-driven, but this round found no qualifying same-motion CPU improvement; production rendering is unchanged.
Validation and scope
Integrated-head scripts typecheck, production Knip, focused lint/format, and diff check passed. Independent P0–P2 autoreview passed both before and after main integration. Earlier candidate proof also passed UI typecheck/build and production Knip; the final diff has no UI or dependency changes. No unit test file changed, and no broad local suite was run. The targeted benchmark observations above provide the runtime proof. Main integration preserved its Firefox and allocation-profiling support.
The final change is confined to two benchmark files. Consolidating the controls into the existing idle-scenario owner removed separate control and animation-capture modules. Growth adds measurement boundaries, controls, and realistic running-row inventories. No Solid reactive code is changed (refactor checklist counts: 0 owners, 0 effects, 0 memos, 0 props/lifecycle changes). Screenshots are not a completion gate for this benchmark-only change; no visual modification is proposed.
LOC against the integrated main base: benchmark runner 1,725 → 1,777 lines; idle scenarios 268 → 363; combined 1,993 → 2,140 (+147 net, +270/−123). Production UI delta: 0 lines.