Skip to content

chore(desktop): measure the startup bench from the screen - #49894

Merged
Hona merged 1 commit into
v2from
bench-screen
Sep 19, 2026
Merged

Hona merged 1 commit into
v2from
bench-screen

Conversation

@Hona

@Hona Hona commented Sep 19, 2026

Copy link
Copy Markdown
Member

The startup bench reported shellVisible from the DOM and firstPaint from the renderer's paint timing. Neither is what the user sees:

  • Chromium stops painting a window it considers occluded. The bench window sat behind the developer's foreground window, so paint timings depended on what else was on screen (some sessions had none at all).
  • The splash counts as "first paint", and the shell counts as "visible" while the 300 ms splash fade is still covering it and the GPU is still compiling the shell's shaders.
measured v2 today, warm what it means
firstPaint ~650 the pulsing-logo splash
shellVisible (DOM) ~880 tab strip exists in the DOM
screenSettled (new) ~1300–1500 the interface is on screen and stops changing

  • A pwsh helper is started before the app; it pins the app's main window topmost without activating it (SetWindowPos HWND_TOPMOST, SWP_NOACTIVATE) the moment the handle exists, then samples a 16×16 pixel grid of the window every ~30 ms for 3 s.
  • screenPainted: first sample that differs from the background colour. screenSettled: first sample after which the content no longer changes.
  • --window-at x,y rewrites the profile's window-state so the bench window restores on a display the developer's window does not cover (displayBounds resolved from the screens).
  • DOM probes are scoped to #root so a static pre-rendered snapshot cannot count as the shell; document.visibilityState is recorded as documentVisible.
  • BENCH_SCREEN_DUMP=<dir> saves every sample as PNG (the filmstrip above), BENCH_EXTRA_ARGS passes extra Chromium switches to the app.

Also surfaced by this: the GPU shader disk cache never persists in this app's profile (GPUCache/index has 0 entries after 40 s runs and graceful exits), so every launch recompiles ~30 shader programs for the shell on the GPU main thread (~15 ms each, serialised) before the first frame of the interface can be presented. Separate issue.

Renderer paint timing does not say when the user sees the interface:
Chromium stops painting a window it considers occluded, and a splash
or a fade reads as painted long before the shell is on screen. The
harness now pins the window topmost without activating it the moment it
exists, samples its pixels, and reports when they first differ from the
background (screenPainted) and when they stop changing (screenSettled).
--window-at restores the window on a display the developer's foreground
window does not cover, DOM probes are scoped to #root so a static
snapshot cannot count as the shell, BENCH_SCREEN_DUMP saves the samples
and BENCH_EXTRA_ARGS passes Chromium switches.
@Hona
Hona requested a review from Brendonovich as a code owner September 19, 2026 03:49
Copilot AI lite review requested due to automatic review settings September 19, 2026 03:49

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Hona
Hona merged commit 7125f5f into v2 Sep 19, 2026
10 checks passed
@Hona
Hona deleted the bench-screen branch September 19, 2026 04:07
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
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.

2 participants