Skip to content

perf(ui): distinguish settled idle from hidden transition work - #194095

Merged
steipete merged 4 commits into
mainfrom
solid2/w-perf-idle-cpu-round2-1106
Nov 6, 2026
Merged

steipete merged 4 commits into
mainfrom
solid2/w-perf-idle-cpu-round2-1106

Conversation

@steipete

@steipete steipete commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

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 0 deliberately 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.

Hidden Chromium 1×, 60 s settling + 30 s measurement Base CPU ms/min Candidate CPU ms/min
Connected 200-clock app 3.830 4.304
about:blank 8.785 3.632
Static HTML 10.555 3.784

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.

Visible running rows Chromium 1× CPU ms/min (profiled) Chromium 6× CPU ms/min WebKit style elapsed ms/min
1 3,103.74 15,170.14 6,702.19
5 3,336.74 16,772.60 6,942.29
20 4,064.33 20,612.36 7,976.57

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.

Acceptance metric Base median → candidate median, ms/min Median change Base p95 → candidate p95 A/A median change
Chromium 1× thread CPU 2,456.58 → 2,520.96 +2.62% 3,730.79 → 3,548.93 +0.75%
Chromium 6× thread CPU 15,225.18 → 15,958.02 +4.81% 17,955.88 → 18,264.13 +2.40%
WebKit style elapsed 6,156.38 → 6,201.47 +0.73% 6,573.80 → 6,546.56 −0.34%

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.

@clawsweeper

clawsweeper Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Nov 6, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T11:32:15.886876Z ddd4af7 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +986 to +990
if (isEngineIdleScenario(scenario) && idleWarmupMs > 0) {
await new Promise<void>((resolve) => {
setTimeout(resolve, idleWarmupMs);
});
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@steipete
steipete enabled auto-merge (squash) November 6, 2026 11:35
@steipete
steipete merged commit 63bc88f into main Nov 6, 2026
114 of 116 checks passed
@steipete
steipete deleted the solid2/w-perf-idle-cpu-round2-1106 branch November 6, 2026 11:37
@steipete

steipete commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 7, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant