Skip to content

fix(perf): measure live Control UI boots without readiness polling - #199081

Merged
steipete merged 1 commit into
mainfrom
solid2/w-webkit-boot-round2-1114
Nov 14, 2026
Merged

steipete merged 1 commit into
mainfrom
solid2/w-webkit-boot-round2-1114

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The live-Gateway boot benchmark injects readiness polling into the browser window being profiled and cannot reproduce the campaign's delayed-network cases.

Related: #198911.

User Impact

No user-visible UI change. This is a measurement correction; all experimental application changes were rejected and reverted. No application speedup is claimed.

Why This Change Was Made

The existing probe now emits one fixed readiness console message; the runner installs its listener before navigation and observes navigation/readiness together. This removes page.waitForFunction polling from the measured document. Optional BOOT_RTT_MS (0–1000, default 0) reuses the existing TCP latency proxy and admission owner's public origin. The rig closes its proxy with its other resources, records RTT in each observation, and logs failed requests to preserve transport diagnostics.

The smallest complete change stays in the existing benchmark: no new proxy, fixture, state owner, dependency, or application abstraction. Benchmark LOC: 514 → 537 (+39/−16); application/test LOC unchanged. Screenshots do not apply because the rendered UI is unchanged.

Evidence

The workload uses a real isolated local Gateway, 400 synthetic transcript messages, desktop 1440×1100, native HTTP cache, and blocked service workers. Browser diagnostics are separate from untraced timing. Acceptance was WebKit warm whole-ready median at least 5% faster at both localhost and 100 ms RTT, with Chromium/Firefox cold/warm within the timing band and p95 assessed against A/A. Each complete matrix uses 20 rotated base/head/base triplets (360 readiness observations), with host load recorded.

Check Result
Scripts typecheck pnpm tsgo:scripts passed
Focused lint and formatting Passed for the changed script
Production Knip pnpm deadcode:knip passed
UI build Passed after reverting every application experiment
Fresh independent review No actionable P0–P2 findings in benchmark + complete coupled owner context
Final runner smoke localhost: 18/18 cold/warm ready observations, 1 page-error rows; 100 ms RTT: 18/18 cold/warm ready observations, 3 page-error rows. Reload errors are recorded, not called clean correctness
Strict same-machine base/head bytes Passed: startup JS 90,922 B gzip, CSS 40,757 B gzip; 3 JS / 1 CSS requests; all measured byte surfaces +0 B; pre-existing absolute-budget warnings remain; no ceiling or baseline changes

Rerunnable benchmark command (built Gateway/plugin metadata and both UI bundles required):

BOOT_BASE=.artifacts/base BOOT_HEAD=dist/control-ui \
BOOT_ENGINES=chromium,webkit,firefox BOOT_PAIRS=20 \
BOOT_RTT_MS=100 BOOT_OUT=.artifacts/boot-rtt100 \
node --import ./scripts/tsx.mjs scripts/perf/control-ui-live-boot.ts

Application experiments: none accepted

Accent-property batching produced no gain. Deferring the runtime import helped localhost but not 100 ms RTT beyond A/A. Unconditionally yielding before construction regressed Chromium warm boot by 7.8%. Racing the existing connect-dispatch receipt against a bounded task deadline was the strongest localhost result, but regressed delayed-network WebKit; its full table is below. Separating context construction from mounting then produced only −0.35% WebKit warm movement (427 → 425.5 ms), while A/A reached 419.5 ms. These application candidates are absent from this diff.

Strongest receipt-race candidate, rejected, values median / p95 ms. Control is unchanged base, rotated with the other arms:

Network Engine/state Base Candidate Control
localhost chromium cold 372.85 / 385.50 372.75 / 382.10 365.45 / 384.30
localhost chromium warm 205.75 / 217.30 206.75 / 222.10 203.50 / 228.60
localhost firefox cold 463.00 / 501.00 460.50 / 489.00 462.50 / 510.00
localhost firefox warm 424.50 / 452.00 427.50 / 446.00 423.00 / 460.00
localhost webkit cold 596.00 / 644.00 593.50 / 650.00 592.50 / 622.00
localhost webkit warm 429.50 / 472.00 387.50 / 402.00 436.50 / 461.00
100 ms RTT chromium cold 818.45 / 833.20 816.80 / 829.00 817.80 / 831.40
100 ms RTT chromium warm 1067.90 / 1088.50 1066.05 / 1095.40 1064.50 / 1093.30
100 ms RTT firefox cold 1063.00 / 1090.00 1071.50 / 1095.00 1070.50 / 1088.00
100 ms RTT firefox warm 1106.50 / 1123.00 1107.50 / 1125.00 1105.00 / 1125.00
100 ms RTT webkit cold 972.50 / 986.00 968.50 / 985.00 972.50 / 987.00
100 ms RTT webkit warm 840.00 / 876.00 867.00 / 923.00 847.00 / 879.00

WebKit warm localhost improved 9.78%, but 100 ms RTT regressed 3.21% median / 5.36% p95, against A/A +0.83% median. The localhost challenge-to-connect phase fell 111 → 39 ms; Chromium stayed 6.9 → 6.9 ms, Firefox 16 → 15.5 ms. This demonstrates application construction/scheduling interference, but fails whole-flow acceptance. Base-arm one-minute host load ranged roughly 4.1–7.1 locally and 2.9–6.5 at RTT.

Known local failure: the first receipt-race matrix stopped after 130 ready observations at Chromium candidate cold pair 7: an unchanged shared CSS preload failed, followed by the 30-second readiness timeout. The 374,738 B CSS asset is byte-identical (SHA-256 1b092e9e5b8a9413fc3bf141fcabd6372d4dd44b0df58b8c3e6e4a4970b5417a) and both UI index hashes matched recorded manifests. The preload failure occurs before the experimental runtime function can run; its warm-only branch was inactive on that cold case. One bounded instrumented base/candidate/control reproduction completed all six cold/warm loads, and subsequent full localhost and RTT matrices each completed 360 readiness checks. This is an investigated unresolved local resource failure, not claimed fixed or inherited: the original request's transport error/status was not captured. The added failed-request logger preserves it on recurrence. WebKit warm reload index-fetch abort/access-control errors also occurred on baseline/control (6 error rows in the complete local matrix, 60 at RTT); readiness completion is not an error-free claim.

Ten-profile native sampling attribution and source-mapped frame tables

Warm pre-connect sampling attribution

Base UI 4741625; real local Gateway; 400 synthetic messages; desktop 1440×1100; WebKit 27.2 and Chromium 156.0.8078.4; service workers blocked. Ten warm profiles per engine. Diagnostic profiles are separate from untraced timing acceptance.

Qualification and limits

The pinned WebKit StackTrace move constructor omits stopwatchTimestamp during vector growth. A standalone non-OpenClaw reproduction returned 72 samples, 54 with zero timestamps. Pinned source: WebKit 56453fdfe0b0ca6258c23e6453b34f70b885d13f, Source/JavaScriptCore/runtime/SamplingProfiler.h:178. Current upstream defaults the move constructor. No issue was filed upstream.

Dense frames remain ordered. Two named 8 ms boundary loops bracket product work; their samples are excluded. The last start-marker sample and first connect-marker sample identify the slice, and their source IDs match the final document in all ten captures. This excludes prior-document unload work and post-connect stop lag without inventing timestamps. The ten slices retain 521 self samples, with no known-timestamp sample outside the Timeline boundaries. Probe-source IDs separately identify injected observer work. The marker loops are diagnostics only and never used for acceptance timings.

An independent unmarked 10 ms recapture retained 59 exact-window samples with no missing clocks: 16.9% code preparation, versus 20.5% in these denser captures. The low-resolution distribution is consistent. Frame zero is self/leaf, verified against the native implementation and a known leaf/parent workload; protocol prose claiming the reverse is wrong.

Self counts estimate proportional sampled time. They are not fabricated exact CPU milliseconds. Native work without a JavaScript parent is not proven to belong to ScriptProfiler's script intervals. WebKit Timeline/ScriptProfiler intervals are elapsed monotonic time, not thread CPU; sampling can omit native work. No claim decomposes the earlier 133 ms into exact per-frame milliseconds.

WebKit: top 15 self frames

Native symbols are C++; the final column gives one representative nearest source-mapped JavaScript ancestor, not exclusive attribution of every sample in that row. CodeBlockSet::add spans dozens of application/framework owners (the displayed prewarm ancestor occurs in 4 of its 55 samples). Equal counts are tied.

Rank Self frame Self samples /521 Mapped JavaScript location
1 JSC::CodeBlockSet::add 55 (10.6%) ui/src/pages/chat/chat-snapshot-prewarm.ts:95:16
2 WebCore::CSSTokenizer::consumeIdentLikeToken 10 (1.9%) ui/src/pages/chat/route.ts:79:13
3 WebCore::CSSParser::consumeBlockContent 7 (1.3%) ui/src/pages/chat/chat-snapshot-prewarm.ts:94:65
4 JSC::CodeBlock::lineColumnForBytecodeIndex [Inspector stack capture] 7 (1.3%) ui/src/app/route-elements.ts:12:11
5 WebCore::CSSTokenizer::tryCreate 6 (1.2%) ui/src/pages/chat/chat-snapshot-prewarm.ts:94:65
6 WebCore::CSSTokenizer::CSSTokenizer 6 (1.2%) ui/src/pages/chat/chat-snapshot-prewarm.ts:94:65
7 JSC::FunctionCodeBlock::create 6 (1.2%) ui/src/app/app-shell-view-state.ts:346:27
8 operationBitAndHeapBigInt 6 (1.2%) @noble/ed25519/index.js:148:36
9 bmalloc_heap_config_specialized_local_allocator_try_allocate_small_segregated_slow 6 (1.2%) ui/src/lib/theme-color.ts:7:24
10 _dispatch_event_loop_poke 5 (1.0%) ui/src/app/boot-composer.ts:76:15
11 WTF::AtomStringImpl::add(char16_t span) 5 (1.0%) (no mapped JavaScript caller)
12 WebCore::cssPropertyID 4 (0.8%) (no mapped JavaScript caller)
13 WTF::AtomStringImpl::add(unsigned char span) 4 (0.8%) ui/src/pages/chat/route.ts:79:13
14 WebCore::Style::RuleFeatureSet::collectFeatures 4 (0.8%) ui/src/lib/theme-color.ts:7:24
15 JSC::CodeBlock::finishCreation 4 (0.8%) ui/src/pages/chat/session-snapshot-store.ts:135:40

Chromium: top 15 self frames

Same marker-bounded product window, ten captures. Sample intervals are sorted by native timestamp and clipped to the window. Mean estimated elapsed self milliseconds are shown; they are not thread CPU counters. Native (program) remains unattributed. Generated initializer glue retains generated locations when no original mapping exists.

Rank Frame and location Mean self ms
1 (program) @ native/injected:0:0 8.841
2 modP @ @noble/ed25519/index.js:145:15 2.304
3 (garbage collector) @ native/injected:0:0 1.217
4 precompute @ @noble/ed25519/index.js:866:7 1.122
5 probe @ native/injected:2:51 0.871
6 (anonymous) @ /assets/control-ui-connection-CZGGdmtu.js:2:74635 0.752
7 Point.add @ @noble/ed25519/index.js:357:5 0.645
8 (idle) @ native/injected:0:0 0.245
9 (anonymous) @ /assets/control-ui-connection-CZGGdmtu.js:2:68821 0.151
10 (anonymous) @ ui/src/lib/chat/control-ui-database.runtime.ts:13:21 0.151
11 (anonymous) @ /assets/control-ui-connection-CZGGdmtu.js:2:113653 0.151
12 get localStorage @ native/injected:0:0 0.150
13 D @ @noble/ed25519/index.js:194:23 0.150
14 Point @ @noble/ed25519/index.js:246:5 0.150
15 (anonymous) @ /assets/history-state-9kEUbVwz.js:1:1 0.145

Exclusive sampled-work classification

Observer stacks take precedence, followed by compiler/code preparation, then mapped application/native owners. Residual module evaluation is exclusive; module-root counts below are inclusive and must not be added to this table.

Category Samples Share
other application/framework evaluation 124 23.8%
JSC parse/compile/lazy code preparation 107 20.5%
generated CSS preload + native CSS parsing 74 14.2%
theme/palette + native style/canvas 58 11.1%
device signing 42 8.1%
native CSS/style without recoverable JS parent 34 6.5%
profiler/automation 28 5.4%
viewport setup + native layout 17 3.3%
boot composer + native layout 17 3.3%
top-level module evaluation 9 1.7%
cached transcript/store setup 8 1.5%
other native/automation 2 0.4%
JSC runtime/builtins (unattributed) 1 0.2%

JSC preparation: 91 lazy code-block preparation samples, 12 parsing/bytecode-generation samples, and 4 JIT-related samples. Inspector drops execution-tier metadata, so an exact LLInt/Baseline/DFG/FTL execution split is unavailable. No separate product ES-module linking/instantiation self bucket was observed; bytecode linking can be part of code preparation. This does not prove zero linking cost. Code-block creation may reuse cached unlinked bytecode; it does not establish a cache miss.

Source roots

This is a second attribution dimension over the same samples; it overlaps the work categories above.

Root Samples Share
startControlUi → bootstrapApplication, base main.runtime.ts:44:28 110 21.1%
startControlUi → mountOpenClawApp, base main.runtime.ts:44:5 44 8.4%
Other startControlUi work 4 0.8%
Async native-host commit → mount, ui/src/lib/solid-bridge.ts:221:18 96 18.4%
Native module/program rooted samples, including called startup work 71 13.6%
Other async, scheduler, socket, signing and unmapped roots 196 37.6%

The startup function and asynchronous host commits account for 254/521 (48.8%) of all retained samples. Another 61 samples (11.7%) have Solid async/scheduler roots. The native-host commits are Promise continuations; the resulting construction burst can run before a queued WebSocket task. Configuration/locale setup does not emerge as a large individual self-time frame. Theme/palette, viewport/layout, routing/CSS preload, signing and snapshot-store work are named in the work table and source mappings.

Median WebKit marker-window elapsed is 160.20 ms; median ScriptProfiler interval union is 120.76 ms. Chromium's mean clipped sampling window is 18.438 ms. These diagnostic values are not acceptance timings.

Verdict: a fixable startup construction owner is demonstrated; no JSC floor is established. The data follows the application-owner branch, so no dormant-module/byte-scaling result is claimed.

@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review ended

ClawSweeper stopped reviewing this revision because the pull request closed.

View the workflow run.

@chatgpt-codex-connector

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

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T18:29:19.689356Z e682e4a 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.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S labels Nov 14, 2026
@steipete
steipete enabled auto-merge (squash) November 14, 2026 18:32
@steipete
steipete merged commit cc201f4 into main Nov 14, 2026
96 of 97 checks passed
@steipete
steipete deleted the solid2/w-webkit-boot-round2-1114 branch November 14, 2026 18:38
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scripts Repository scripts size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant