Perf: preset-switch (~360 ms) and ⌘K-open (~250–300 ms) stalls in WebKit (pre-existing, mockup) #1054

Open
opened 2026-11-10 10:22:30 +00:00 by kayg · 8 comments
Owner

Found during the dynamic-glass work (#1035). These stalls exist on the approved pass8 mockup too, so they are not a #1035 regression.

  • Preset switch: the worst frame gap has a median of ~350–400 ms (pass8 348 ms; dynamic glass 406 ms).
  • Opening ⌘K in WebKit: a ~250–300 ms stall (pass8 310 ms; now 245 ms), measured with the mockup dev server on the Mac VM.

Perf is the #1 priority and every animation must be free of frame drops, so both have to be profiled and fixed before they get ported. Steps:

  1. Record a Safari timeline on the Cua space or macos-01 (quiet Safari, IndexedDB reset).
  2. Find the long task in each case: style recalc, backdrop layers, or JS.
  3. Fix it.
  4. Report rAF deltas, before and after.

Measure against the production build, not the dev server.

Found during the dynamic-glass work (#1035). These stalls exist on the approved pass8 mockup too, so they are not a #1035 regression. - **Preset switch:** the worst frame gap has a median of ~350–400 ms (pass8 348 ms; dynamic glass 406 ms). - **Opening ⌘K in WebKit:** a ~250–300 ms stall (pass8 310 ms; now 245 ms), measured with the mockup dev server on the Mac VM. Perf is the #1 priority and every animation must be free of frame drops, so both have to be profiled and fixed before they get ported. Steps: 1. Record a Safari timeline on the Cua space or macos-01 (quiet Safari, IndexedDB reset). 2. Find the long task in each case: style recalc, backdrop layers, or JS. 3. Fix it. 4. Report rAF deltas, before and after. Measure against the production build, not the dev server.
Author
Owner

Partly covered by #1063 (head 5a48b7b1c): the 4 s preset/theme freeze in real Safari was the View Transition callback awaiting animation frames; fixed. Style-sheet theme switch now median 27 ms (15 of 20 under 50 ms); the app-wide theme switch is still ~117 ms and the Cmd+K open stall was not touched, so this stays open. Numbers and method are in #1063.

Partly covered by #1063 (head 5a48b7b1c): the 4 s preset/theme freeze in real Safari was the View Transition callback awaiting animation frames; fixed. Style-sheet theme switch now median 27 ms (15 of 20 under 50 ms); the app-wide theme switch is still ~117 ms and the Cmd+K open stall was not touched, so this stays open. Numbers and method are in #1063.
Author
Owner

#1054 perf lane, status: NOT fixed. Real-Safari baseline and root-cause narrowing are done; the fix and the "after" runs are blocked by the Mac VM (details at the end). Nothing to fold in.

Method: production build (vite build) of review/calendar-2 @ 0d759170f (base) served from the Mac VM; real Safari (macOS 26.5.2) through safaridriver at 1440 x 900; fresh Safari quit before each series; rAF deltas for 800 ms after each action (the harness is the one from #1063, plus an idle series). Lock held while measuring. 2026-11-10 21:41 to 22:14 UTC, before the VM degraded.

case (n = 20 each) worst frame, median max runs ≤ 50 ms runs ≤ 33 ms
idle (VM noise floor) 24 ms 26 ms 20/20 20/20
app-wide theme switch (Settings tile), base 131 ms 166 ms 4/20 1/20
app-wide theme switch, base + will-change: transform on the blurred backdrop picture (the earlier #1054 commit) 132 ms 186 ms 4/20 1/20
⌘K open, base 76 ms 161 ms n/a 6/20
⌘K open, base + the same will-change layer 83 ms 192 ms n/a 3/20

1. The will-change layer (the earlier commit on this branch, found with Playwright WebKit) does nothing in real Safari. The numbers are equal within noise, so I reverted it: branch perf/stalls-1054-r2 (head db5cb23d1) has the same tree as base. Do not fold it in as a fix. (The existing branch perf/stalls-1054 is another agent's older work; I did not touch it.)

2. Where the theme-switch time goes (8 to 10 runs each, same session, base build):

experiment worst frame, median
full switch (click on the tile) 131 ms
only the root data-pal attribute swapped, no app JS 75 to 90 ms (one interleaved pair: 90 and 70)
…and every background-image removed 53 ms (so gradients are about 25 to 35 ms of it)
full switch with all filter / backdrop-filter removed 141 to 160 ms (so blur is NOT the cause here)
full switch with scrollIntoView (the tile reveal) made a no-op 160 ms (no change)
  • Forced style recalc after the attribute swap: 16 to 24 ms for 1183 elements (the ~40 custom properties on :root inherit everywhere).
  • The JS that follows the click (microtask flush: setPref, effects, syncEdges, reveal) is 65 to 80 ms in the dev build; of that frost.ms is 1 ms, the adaptive glasses do not run on Settings, scrollIntoView 11 to 21 ms (it also pays for the style flush). The rest is not yet attributed (no CPU profile could be taken, see below).
  • So the remaining suspects, in order: the second/third forced style flush inside the effects (syncEdges reads getComputedStyle and writes root custom properties right after the data-pal swap), repainting the gradients, and the Svelte updates that follow.

3. ⌘K: median 76 ms and only 6/20 under 33 ms; not yet profiled (the palette mounts on search.open inside {#if}).

Why no fix and no "after" table: from about 22:15 UTC the Mac VM's Safari became unusable for frame timing: rAF pauses of 15 s inside runs, safaridriver 408/500 errors, and the app sometimes stays blank (28 elements, never mounts) although the page is visible. The Mac lock was also held for most of the next four hours by other lanes. Every sample/idle attempt after that either failed or sampled an idle process. I will not post numbers from that state. Left on the Mac for the next try: worktrees ~/Developer/Worktrees/st2-base and st2-head (prod builds in apps/mockup/dist), scripts /tmp/st2-run.py (A/B harness, discards runs with a > 2 s rAF pause), /tmp/st2-sample.py (native sample of the WebContent process during 8 switches), /tmp/st2-lock-fast.sh.

Next steps (for whoever resumes): (a) take a native sample of the right WebContent process during the switch to split style / layout / paint / JS; (b) try making the syncEdges + frost writes happen before the first style flush (one recalc instead of two), (c) scope the theme variables (set the ~40 custom properties on fewer ancestors, or swap a precomputed class on the app card only) and compare against the 1183-element recalc, (d) pre-mount the palette hidden for ⌘K. Each needs the Mac VM quiet and un-contended for 20 clean runs.

Not run: the iPhone 18 Pro simulator check of ⌘K (no fix to verify yet).

**#1054 perf lane, status: NOT fixed. Real-Safari baseline and root-cause narrowing are done; the fix and the "after" runs are blocked by the Mac VM (details at the end). Nothing to fold in.** Method: production build (`vite build`) of `review/calendar-2` @ `0d759170f` (base) served from the Mac VM; real Safari (macOS 26.5.2) through safaridriver at 1440 x 900; fresh Safari quit before each series; rAF deltas for 800 ms after each action (the harness is the one from #1063, plus an idle series). Lock held while measuring. 2026-11-10 21:41 to 22:14 UTC, before the VM degraded. | case (n = 20 each) | worst frame, median | max | runs ≤ 50 ms | runs ≤ 33 ms | |---|---|---|---|---| | idle (VM noise floor) | 24 ms | 26 ms | 20/20 | 20/20 | | **app-wide theme switch (Settings tile), base** | **131 ms** | 166 ms | 4/20 | 1/20 | | app-wide theme switch, base + `will-change: transform` on the blurred backdrop picture (the earlier #1054 commit) | 132 ms | 186 ms | 4/20 | 1/20 | | **⌘K open, base** | **76 ms** | 161 ms | n/a | 6/20 | | ⌘K open, base + the same `will-change` layer | 83 ms | 192 ms | n/a | 3/20 | **1. The `will-change` layer (the earlier commit on this branch, found with Playwright WebKit) does nothing in real Safari.** The numbers are equal within noise, so I reverted it: branch `perf/stalls-1054-r2` (head `db5cb23d1`) has the same tree as base. Do not fold it in as a fix. (The existing branch `perf/stalls-1054` is another agent's older work; I did not touch it.) **2. Where the theme-switch time goes** (8 to 10 runs each, same session, base build): | experiment | worst frame, median | |---|---| | full switch (click on the tile) | 131 ms | | only the root `data-pal` attribute swapped, no app JS | 75 to 90 ms (one interleaved pair: 90 and 70) | | …and every `background-image` removed | 53 ms (so gradients are about 25 to 35 ms of it) | | full switch with all `filter` / `backdrop-filter` removed | 141 to 160 ms (so blur is NOT the cause here) | | full switch with `scrollIntoView` (the tile reveal) made a no-op | 160 ms (no change) | * Forced style recalc after the attribute swap: 16 to 24 ms for 1183 elements (the ~40 custom properties on `:root` inherit everywhere). * The JS that follows the click (microtask flush: setPref, effects, `syncEdges`, reveal) is 65 to 80 ms in the dev build; of that `frost.ms` is 1 ms, the adaptive glasses do not run on Settings, `scrollIntoView` 11 to 21 ms (it also pays for the style flush). The rest is not yet attributed (no CPU profile could be taken, see below). * So the remaining suspects, in order: the second/third forced style flush inside the effects (`syncEdges` reads `getComputedStyle` and writes root custom properties right after the `data-pal` swap), repainting the gradients, and the Svelte updates that follow. **3. ⌘K**: median 76 ms and only 6/20 under 33 ms; not yet profiled (the palette mounts on `search.open` inside `{#if}`). **Why no fix and no "after" table:** from about 22:15 UTC the Mac VM's Safari became unusable for frame timing: rAF pauses of 15 s inside runs, safaridriver 408/500 errors, and the app sometimes stays blank (28 elements, never mounts) although the page is `visible`. The Mac lock was also held for most of the next four hours by other lanes. Every `sample`/idle attempt after that either failed or sampled an idle process. I will not post numbers from that state. Left on the Mac for the next try: worktrees `~/Developer/Worktrees/st2-base` and `st2-head` (prod builds in `apps/mockup/dist`), scripts `/tmp/st2-run.py` (A/B harness, discards runs with a > 2 s rAF pause), `/tmp/st2-sample.py` (native `sample` of the WebContent process during 8 switches), `/tmp/st2-lock-fast.sh`. **Next steps (for whoever resumes):** (a) take a native `sample` of the right WebContent process during the switch to split style / layout / paint / JS; (b) try making the `syncEdges` + frost writes happen before the first style flush (one recalc instead of two), (c) scope the theme variables (set the ~40 custom properties on fewer ancestors, or swap a precomputed class on the app card only) and compare against the 1183-element recalc, (d) pre-mount the palette hidden for ⌘K. Each needs the Mac VM quiet and un-contended for 20 clean runs. Not run: the iPhone 18 Pro simulator check of ⌘K (no fix to verify yet).
Author
Owner

#1054 perf lane, round 3 (branch perf/stalls-1054-r3, head 68ee52862 = tree of f8ea15d25): NOT fixed. Targets missed (theme switch ≤ 50 ms in 20/20, ⌘K with no frame over 33 ms). The slow frame is now located; two small changes are in.

Method: production builds (vite build) of review/calendar-2 @ 0bc3f77bc (base) and the branch; real Safari 26.5.2 on macos-01 through safaridriver, 1440 x 900, Safari quit before each run, Mac lock held per run, blank page first (62 rAF/s; the app 60 to 62 rAF/s). Caveat: from about 08:50 IST the Mac VM was under outside load (load average 6 to 10 on 4 cores between my runs, outliers of 300 to 1000 ms), so the later numbers are noisy. Interleaved A/B only; no number below is a clean 20/20.

1. Where a theme switch (Settings tile) goes (native sample of WebContent, base build)

Per switch the main thread did about 35 ms, but the frame took 90 to 130 ms:

  • 3 forced full style resolves in the click's microtasks: getComputedStyle().getPropertyValue (syncEdges, 85 samples), getComputedStyle(root).backgroundColor (the setThemeColor line, 69) and the tile reveal scrollIntoView (46). Style cost is dominated by comparing custom-property data (CustomPropertyData::operator==).
  • The WebContent RemoteLayerTreeDrawingArea.CommitQueue sat about 100 ms per switch in flushAndCollectHandles: it waits for the GPU process to repaint. That wait is the remaining slow frame.
  • After the click, document.getAnimations() held 107 to 128 running animations (55 colour, 21 box-shadow, 18 background-colour CSS transitions of 120 to 160 ms), so 3 to 4 frames in a row were slow, not one.

CSS knobs injected before the click (head build, n = 10 each, worst frame median): none 112 ms; .themegrad hidden 87; .pic (frost copies) hidden 101; all backdrop-filter off 102 (blur is not it); .backdrop hidden 88; all transitions off 84. So the gradients are about 25 ms and the repaint of everything else is a floor of about 85 ms on this VM.

2. What is on the branch

commit change result
1e7c91a75 @property inherits:false for --edge-key/--edge-glass/--edge-glass-bottom (read only by root rules; mockup only) so the edge writes do not restyle all 1183 elements worst frame median: base 93, 97; with it 118, 88 (n = 10 each, ABAB). No measurable gain. Kept because it is free and correct; drop it if you want zero unproven changes.
f8ea15d25 lib/settle.ts: finish the colour transitions the theme swap just started, right after the style flush syncEdges forces stalled frames per switch (>25 ms): base 3 to 4 (e.g. 58/140/84, 32/81/63/46), after 1 to 2 (e.g. 76, 98, 65). JS part 17 ms, first rAF 2 to 4 ms. Worst frame unchanged (about 90 to 110 ms). Under the later load, base had its first rAF 94 to 115 ms late and 3 slow frames, the branch 6 to 10 ms and 1 to 2.
e2fb02e30 + revert 68ee52862 pre-mount the palette hidden (visibility:hidden + inert) at idle ⌘K worst frame median: previous build 63 / 106 / 74 / 67, pre-mounted 103 / 69 / 83 / 223 (noisy). No gain, reverted (it would also put an always-built dialog into every spec).

3. Look unchanged

Computed values after switching to four themes (catppuccin, nord, dracula, gruvbox), base vs branch, 1035 visible elements each (color, background-color, background-image, box-shadow, border/outline colour, fill, opacity, transition-property), plus the root's --paper --ink --accent --glass --theme-grad --edge-*, both theme-color metas and the body background:

theme elements differing root vars theme-color body bg
all four 1035 / 1035 22 each equal equal equal

The 22 differing elements are only the random url(#av-xxxx) ids of the avatar SVG fills (a new hash per build), no colour.

4. ⌘K (4 + 4 runs per knob, noisy)

Opening costs about 17 ms of JS (mount included), then a long frame. Hiding only the preview pane (.layer .preview) brought the worst frame median to 37 and 43 ms, while the same session's other cases were 60 to 300 ms: the first result's note preview (NotePreview: blocksHTML + {@html} of the whole note, then hit marking) is the cost, in style/layout/paint, not in JS. Hiding the glass: 67 ms; not conclusive.

5. Next steps (need a quiet VM, and one is a look decision)

  1. ⌘K: make the first preview cheap without changing what it shows: render only the blocks that fit (the rest after idle) while no query is typed, or content-visibility: auto with measured intrinsic sizes. Needs the scroll-to-hit maths checked.
  2. Theme switch: the 85 ms floor is the GPU repaint of the whole window. Ideas: fewer repainted layers (drop the frost copies of the gradient: about 11 ms; render the gradient once per theme into a small canvas/image: about 25 ms but not pixel-identical, kayg's call).
  3. Not done: the iPhone 18 Pro simulator check of ⌘K (no ⌘K change shipped). The throwaway harness (st3-run.py, st3.sh) lives on the Mac in ~/st3; JSON per run in ~/st3/out.

Honest process note: two of my wrapper scripts kept the Mac lock for about 14 and 35 minutes after their runs ended (a bare wait on my own http.server); I stopped only my own PIDs and fixed the script.

**#1054 perf lane, round 3 (branch `perf/stalls-1054-r3`, head `68ee52862` = tree of `f8ea15d25`): NOT fixed. Targets missed (theme switch ≤ 50 ms in 20/20, ⌘K with no frame over 33 ms). The slow frame is now located; two small changes are in.** Method: production builds (`vite build`) of `review/calendar-2` @ `0bc3f77bc` (base) and the branch; real Safari 26.5.2 on macos-01 through safaridriver, 1440 x 900, Safari quit before each run, Mac lock held per run, blank page first (62 rAF/s; the app 60 to 62 rAF/s). **Caveat: from about 08:50 IST the Mac VM was under outside load (load average 6 to 10 on 4 cores between my runs, outliers of 300 to 1000 ms), so the later numbers are noisy. Interleaved A/B only; no number below is a clean 20/20.** ## 1. Where a theme switch (Settings tile) goes (native `sample` of WebContent, base build) Per switch the main thread did about 35 ms, but the frame took 90 to 130 ms: * 3 forced full style resolves in the click's microtasks: `getComputedStyle().getPropertyValue` (`syncEdges`, 85 samples), `getComputedStyle(root).backgroundColor` (the `setThemeColor` line, 69) and the tile reveal `scrollIntoView` (46). Style cost is dominated by comparing custom-property data (`CustomPropertyData::operator==`). * The WebContent `RemoteLayerTreeDrawingArea.CommitQueue` sat about 100 ms per switch in `flushAndCollectHandles`: it waits for the GPU process to repaint. That wait is the remaining slow frame. * After the click, `document.getAnimations()` held 107 to 128 running animations (55 colour, 21 box-shadow, 18 background-colour CSS transitions of 120 to 160 ms), so 3 to 4 frames in a row were slow, not one. CSS knobs injected before the click (head build, n = 10 each, worst frame median): none 112 ms; `.themegrad` hidden 87; `.pic` (frost copies) hidden 101; all `backdrop-filter` off 102 (blur is not it); `.backdrop` hidden 88; all transitions off 84. So the gradients are about 25 ms and the repaint of everything else is a floor of about 85 ms on this VM. ## 2. What is on the branch | commit | change | result | |---|---|---| | `1e7c91a75` | `@property inherits:false` for `--edge-key/--edge-glass/--edge-glass-bottom` (read only by root rules; mockup only) so the edge writes do not restyle all 1183 elements | worst frame median: base 93, 97; with it 118, 88 (n = 10 each, ABAB). **No measurable gain.** Kept because it is free and correct; drop it if you want zero unproven changes. | | `f8ea15d25` | `lib/settle.ts`: finish the colour transitions the theme swap just started, right after the style flush `syncEdges` forces | stalled frames per switch (>25 ms): base 3 to 4 (e.g. 58/140/84, 32/81/63/46), after 1 to 2 (e.g. 76, 98, 65). JS part 17 ms, first rAF 2 to 4 ms. **Worst frame unchanged (about 90 to 110 ms).** Under the later load, base had its first rAF 94 to 115 ms late and 3 slow frames, the branch 6 to 10 ms and 1 to 2. | | `e2fb02e30` + revert `68ee52862` | pre-mount the palette hidden (`visibility:hidden` + inert) at idle | ⌘K worst frame median: previous build 63 / 106 / 74 / 67, pre-mounted 103 / 69 / 83 / 223 (noisy). **No gain, reverted** (it would also put an always-built dialog into every spec). | ## 3. Look unchanged Computed values after switching to four themes (catppuccin, nord, dracula, gruvbox), base vs branch, 1035 visible elements each (`color`, `background-color`, `background-image`, `box-shadow`, border/outline colour, `fill`, `opacity`, `transition-property`), plus the root's `--paper --ink --accent --glass --theme-grad --edge-*`, both `theme-color` metas and the body background: | theme | elements | differing | root vars | theme-color | body bg | |---|---|---|---|---|---| | all four | 1035 / 1035 | 22 each | equal | equal | equal | The 22 differing elements are only the random `url(#av-xxxx)` ids of the avatar SVG fills (a new hash per build), no colour. ## 4. ⌘K (4 + 4 runs per knob, noisy) Opening costs about 17 ms of JS (mount included), then a long frame. Hiding only the preview pane (`.layer .preview`) brought the worst frame median to 37 and 43 ms, while the same session's other cases were 60 to 300 ms: the first result's note preview (`NotePreview`: `blocksHTML` + `{@html}` of the whole note, then hit marking) is the cost, in style/layout/paint, not in JS. Hiding the glass: 67 ms; not conclusive. ## 5. Next steps (need a quiet VM, and one is a look decision) 1. ⌘K: make the first preview cheap without changing what it shows: render only the blocks that fit (the rest after idle) while no query is typed, or `content-visibility: auto` with measured intrinsic sizes. Needs the scroll-to-hit maths checked. 2. Theme switch: the 85 ms floor is the GPU repaint of the whole window. Ideas: fewer repainted layers (drop the frost copies of the gradient: about 11 ms; render the gradient once per theme into a small canvas/image: about 25 ms but not pixel-identical, kayg's call). 3. Not done: the iPhone 18 Pro simulator check of ⌘K (no ⌘K change shipped). The throwaway harness (`st3-run.py`, `st3.sh`) lives on the Mac in `~/st3`; JSON per run in `~/st3/out`. Honest process note: two of my wrapper scripts kept the Mac lock for about 14 and 35 minutes after their runs ended (a bare `wait` on my own http.server); I stopped only my own PIDs and fixed the script.
Author
Owner

#1054 round 4: theme switch improved (target met in kayg's new form for 19/20 runs), ⌘K NOT fixed (reverted). Head 05a97d69e, merged into review/calendar-2 (fast-forward) and calendar-2 redeployed.

Real Safari 26.5.2 on macos-01, production builds, paired A/B in one Safari session (fresh page per sample, order alternated), 20 switches each, Safari quit first, Mac lock held. All timings quoted were taken before 12:12 UTC (the std contention window); the later fin-k and fin-t runs are discarded.

What merged (one commit)

lib/settle.ts (finishes the colour fades a theme switch starts), lib/edges.ts (syncEdges now runs once per frame in an animation-frame callback, so the three forced style recalcs in the click task are gone: the syncEdges read, the theme-color read, and the tile reveal), ThemeRow.svelte (reveal after two frames), App.svelte. 1e7c91a75 (the @property commit) is dropped as asked.

Theme switch (Settings tile), head vs base, n = 20 each, three paired runs

Gate: exactly one long frame (the full-window redraw), every other frame ≤ 33 ms.

run base: runs with ≤ 1 frame > 33 ms head: same base: 2nd-worst frame median / max head: 2nd-worst median / max
1 6/20 19/20 80 / 243 ms 22 / 107 ms
2 7/20 19/20 59.5 / 348 ms 22 / 52 ms
3 (quiet) 4/20 19/20 47.5 / 72 ms 23 / 47 ms
The worst frame (the redraw) is about 107 to 160 ms on both, as expected and accepted. The one miss in 19/20 is the same run each time type: a second frame of 34 to 52 ms, never a stall.

⌘K: not met, nothing merged

Opening is about 11 to 17 ms of JS, then one long frame. A/B at 20 runs: worst-frame median 85 to 92 ms for both base and every variant I tried. Variants (all reverted, branch perf/stalls-1054-r3-preview keeps the first one): first screen of blocks only plus rest at idle (no gain); pre-mounted palette (no gain); preview pane two frames after the open and the note words one frame later (worse: second-worst frame median 32 to 42 vs 24); preview glass one frame later (worse, 42 vs 22). Knob test: with the preview pane hidden the open's worst frame median is 27.5 to 40 ms (13 of 14 runs ≤ 50), with only the preview's .float-glass hidden 40 ms, so the cost is the preview pane's glass (backdrop blur of a large new layer) appearing in the open's frame, not the note's HTML. Splitting it across frames only moves the cost into a second long frame. Next idea, not tried: keep the preview glass layer permanently composited (it is mounted only when there is a result) or open the pane without its own blur and fade it in; both change how it looks or loads, so I stopped.

Checks

dev-01 Chromium, my branch: appearance, status-bar, themes specs 89 passed, 1 failed (appearance.spec.ts:173, a 90 s timeout in document.fonts.ready under heavy host load); the same test passes on current calendar-2 base (1/1) and on my branch 3/3 with --repeat-each=3, so flaky under load, not related. The earlier chrome/round9b/style-sheet run was cut short when my systemd job vanished (exit 137), so those three were not completed. svelte-check was run but the mockup reports 783 module-resolution errors on this host unrelated to the change.
Look unchanged: computed-value diff of four themes (earlier comment): equal except random avatar SVG ids; this commit only changes when the same writes happen.

Not done

iPhone 18 Pro simulator ⌘K check: no ⌘K change shipped, and std is in the infraternal test windows. Run it with the next ⌘K fix.

**#1054 round 4: theme switch improved (target met in kayg's new form for 19/20 runs), ⌘K NOT fixed (reverted). Head `05a97d69e`, merged into `review/calendar-2` (fast-forward) and calendar-2 redeployed.** Real Safari 26.5.2 on macos-01, production builds, paired A/B in one Safari session (fresh page per sample, order alternated), 20 switches each, Safari quit first, Mac lock held. All timings quoted were taken before 12:12 UTC (the std contention window); the later `fin-k` and `fin-t` runs are discarded. ## What merged (one commit) `lib/settle.ts` (finishes the colour fades a theme switch starts), `lib/edges.ts` (`syncEdges` now runs once per frame in an animation-frame callback, so the three forced style recalcs in the click task are gone: the `syncEdges` read, the `theme-color` read, and the tile reveal), `ThemeRow.svelte` (reveal after two frames), `App.svelte`. `1e7c91a75` (the `@property` commit) is dropped as asked. ## Theme switch (Settings tile), head vs base, n = 20 each, three paired runs Gate: exactly one long frame (the full-window redraw), every other frame ≤ 33 ms. | run | base: runs with ≤ 1 frame > 33 ms | head: same | base: 2nd-worst frame median / max | head: 2nd-worst median / max | |---|---|---|---|---| | 1 | 6/20 | 19/20 | 80 / 243 ms | 22 / 107 ms | | 2 | 7/20 | 19/20 | 59.5 / 348 ms | 22 / 52 ms | | 3 (quiet) | 4/20 | 19/20 | 47.5 / 72 ms | 23 / 47 ms | The worst frame (the redraw) is about 107 to 160 ms on both, as expected and accepted. The one miss in 19/20 is the same run each time type: a second frame of 34 to 52 ms, never a stall. ## ⌘K: not met, nothing merged Opening is about 11 to 17 ms of JS, then one long frame. A/B at 20 runs: worst-frame median 85 to 92 ms for both base and every variant I tried. Variants (all reverted, branch `perf/stalls-1054-r3-preview` keeps the first one): first screen of blocks only plus rest at idle (no gain); pre-mounted palette (no gain); preview pane two frames after the open and the note words one frame later (worse: second-worst frame median 32 to 42 vs 24); preview glass one frame later (worse, 42 vs 22). Knob test: with the preview pane hidden the open's worst frame median is 27.5 to 40 ms (13 of 14 runs ≤ 50), with only the preview's `.float-glass` hidden 40 ms, so **the cost is the preview pane's glass (backdrop blur of a large new layer) appearing in the open's frame, not the note's HTML**. Splitting it across frames only moves the cost into a second long frame. Next idea, not tried: keep the preview glass layer permanently composited (it is mounted only when there is a result) or open the pane without its own blur and fade it in; both change how it looks or loads, so I stopped. ## Checks dev-01 Chromium, my branch: appearance, status-bar, themes specs 89 passed, 1 failed (`appearance.spec.ts:173`, a 90 s timeout in `document.fonts.ready` under heavy host load); the same test passes on current calendar-2 base (1/1) and on my branch 3/3 with `--repeat-each=3`, so flaky under load, not related. The earlier chrome/round9b/style-sheet run was cut short when my systemd job vanished (exit 137), so those three were not completed. svelte-check was run but the mockup reports 783 module-resolution errors on this host unrelated to the change. Look unchanged: computed-value diff of four themes (earlier comment): equal except random avatar SVG ids; this commit only changes when the same writes happen. ## Not done iPhone 18 Pro simulator ⌘K check: no ⌘K change shipped, and std is in the infraternal test windows. Run it with the next ⌘K fix.
Author
Owner

#1054 ⌘K round: A and B both measured in real Safari; neither reaches the target (worst frame < 33 ms). Nothing to merge. Branches for reference: perf/stalls-1054-k (A, head 96d219cde), perf/stalls-1054-kb (B, head 031b555c5).

Method as before (Mac VM, production builds with rm -rf dist first, paired A/B in one Safari session, fresh page per sample, 20 each, Mac lock held). Valid timings are only those after the window ended at 15:31 UTC; the runs kA-k, kA-idle taken 15:19 to 15:33 UTC are discarded.

Correction: my earlier "pre-mounted palette: no gain" result was measured on a stale dist/ (the build had failed on a duplicate identifier, and ls dist printed the old bundle). A is therefore the first real test of pre-mounting.

variant (⌘K open, 20 runs each) base worst-frame median / max variant worst-frame median / max variant: runs with 0 frames over 33 ms
A: whole palette built at idle, opacity: 0, inert, aria-hidden (kC-A) 65 / 139 ms 77.5 / 755 ms 0/20
A again (kC-held, same build) 76.5 / 607 ms 86.5 / 279 ms 0/20
B: first preview's glass blur 0 to full over 140 ms (kB-k) 78.5 / 410 ms 70.5 / 238 ms 0/20
knob: preview glass backdrop-filter: none (look would change slightly) 76.5 / 607 ms 56.5 / 278 ms 0/20
Second-worst frames are ≤ 29 ms everywhere, i.e. the open is exactly one long frame, as for the theme switch.

Reading: pre-mounting keeps no useful layer (no gain, even slightly worse), so the cost is not layer creation. The blur ramp gains about 8 ms (noise-sized). Removing the preview glass's blur entirely gains about 20 ms but still leaves about 56 ms; earlier knob runs showed hiding the whole preview pane gives 27 to 40 ms. So the long frame is the preview pane as a whole (its glass plus the note laid out and painted in a container-type: size box) appearing in one frame; no one piece gets it under 33 ms.
A idle/scroll costs were not measured because A does not ship; the scroll harness also did not find the list scroller (selector needs fixing before reuse). B's idle cost is nil by construction (nothing is mounted until open).

Specs (dev-01, Chromium, under ~/bin/slot, current review/calendar-2 568b707c0, which includes the theme-switch commit): chrome, round9b, style-sheet: 110 passed (24.5 min). The earlier failures on branch A (an extra dialog role from the asleep palette, fixed by aria-hidden) are specific to A.
iPhone sim ⌘K check: not done, since no ⌘K change ships.

Options for the next step (need a decision):

  1. Accept the open as one ~65 to 80 ms frame (it is one frame, 2nd-worst is 22 ms), like the theme switch.
  2. Open the pane after the panel: preview pane mounts at the first idle after the open without its glass blur at all (tint only, since the panel's own blur is already behind it: look change to check by eye), measured about 56 ms in the knob; still over 33.
  3. Make the preview pane cheap in itself (drop container-type: size, first-screen blocks only, no pane box-shadow) combined with 2; I have not measured the combination.
**#1054 ⌘K round: A and B both measured in real Safari; neither reaches the target (worst frame < 33 ms). Nothing to merge. Branches for reference: `perf/stalls-1054-k` (A, head `96d219cde`), `perf/stalls-1054-kb` (B, head `031b555c5`).** Method as before (Mac VM, production builds with `rm -rf dist` first, paired A/B in one Safari session, fresh page per sample, 20 each, Mac lock held). Valid timings are only those after the window ended at 15:31 UTC; the runs `kA-k`, `kA-idle` taken 15:19 to 15:33 UTC are discarded. **Correction:** my earlier "pre-mounted palette: no gain" result was measured on a stale `dist/` (the build had failed on a duplicate identifier, and `ls dist` printed the old bundle). A is therefore the first real test of pre-mounting. | variant (⌘K open, 20 runs each) | base worst-frame median / max | variant worst-frame median / max | variant: runs with 0 frames over 33 ms | |---|---|---|---| | A: whole palette built at idle, `opacity: 0`, inert, aria-hidden (`kC-A`) | 65 / 139 ms | 77.5 / 755 ms | 0/20 | | A again (`kC-held`, same build) | 76.5 / 607 ms | 86.5 / 279 ms | 0/20 | | B: first preview's glass blur 0 to full over 140 ms (`kB-k`) | 78.5 / 410 ms | 70.5 / 238 ms | 0/20 | | knob: preview glass `backdrop-filter: none` (look would change slightly) | 76.5 / 607 ms | 56.5 / 278 ms | 0/20 | Second-worst frames are ≤ 29 ms everywhere, i.e. the open is exactly one long frame, as for the theme switch. **Reading:** pre-mounting keeps no useful layer (no gain, even slightly worse), so the cost is not layer creation. The blur ramp gains about 8 ms (noise-sized). Removing the preview glass's blur entirely gains about 20 ms but still leaves about 56 ms; earlier knob runs showed hiding the whole preview pane gives 27 to 40 ms. So the long frame is the preview pane as a whole (its glass plus the note laid out and painted in a `container-type: size` box) appearing in one frame; no one piece gets it under 33 ms. A idle/scroll costs were not measured because A does not ship; the scroll harness also did not find the list scroller (selector needs fixing before reuse). B's idle cost is nil by construction (nothing is mounted until open). **Specs** (dev-01, Chromium, under `~/bin/slot`, current `review/calendar-2` `568b707c0`, which includes the theme-switch commit): chrome, round9b, style-sheet: **110 passed** (24.5 min). The earlier failures on branch A (an extra `dialog` role from the asleep palette, fixed by `aria-hidden`) are specific to A. **iPhone sim ⌘K check:** not done, since no ⌘K change ships. **Options for the next step (need a decision):** 1. Accept the open as one ~65 to 80 ms frame (it is one frame, 2nd-worst is 22 ms), like the theme switch. 2. Open the pane after the panel: preview pane mounts at the first idle after the open without its glass blur at all (tint only, since the panel's own blur is already behind it: look change to check by eye), measured about 56 ms in the knob; still over 33. 3. Make the preview pane cheap in itself (drop `container-type: size`, first-screen blocks only, no pane box-shadow) combined with 2; I have not measured the combination.
Author
Owner

#1054 ⌘K round 3 (option 3 + 2): improved, target (< 33 ms) NOT reached. Branch perf/stalls-1054-kc, head 5b5ed4623 (tree of 8069bdd08), off review/calendar-2 b4b1e9693. Best number: open worst-frame median 73 to 45 ms; one long frame remains. Your call whether to merge it.

Real Safari 26.5.2 on macos-01, production builds with rm -rf dist, paired A/B in one session (fresh page per sample, alternating order), 20 runs, Mac lock held, only runs after 15:31 UTC (and one 19:14 to 19:21 UTC pair discarded, since J480 had a Mac build window then).

Change (two commits)

  • e7c4264b1: a note's preview draws only the blocks that fill the pane (fitCount, guess 760 px) at once and the rest in 12-block pieces at idle (from 450 ms on); with words typed everything is drawn at once so hits are marked and scrolled to as before.
  • 8069bdd08: the preview pane (.preview) mounts two animation frames after the open and fades in over 110 ms (no empty flash); container-type: size only on flat previews (a file's page uses cqh); the note preview's glass keeps its tint, inner shade and edge but not a second backdrop-filter (the palette's own glass is already blurring behind it).
    Rejected on measurement: words drawn one frame after the pane (worse: worst median 71 ms, 2nd-worst 38), the earlier pre-mounts and blur ramps.

⌘K open, base vs branch (worst frame, 20 runs each)

page base median / max branch median / max branch runs ≤ 50 ms frames > 33 per run (base / branch, ≤ 1 over)
Settings, run 1 (kd-k) 74.5 / 345 45.0 / 171 12/20 19/20 / 17/20
Settings, run 2 (kg-k) 73.0 / 220 43.5 / 258 12/20 19/20 / 13/20
Notes page, run 2 (kg-k2) 87.0 / 652 52.5 / 687 10/20 14/20 / 11/20
(the notes-page control with the same build twice varied 50 to 85 ms between sessions, so treat that row as about 35 ms better, not exact.) The open is now two medium frames (typical 26 to 40 ms, then 29 to 78 ms) instead of one 75 to 90 ms frame, but the second is still over 33 ms and no run set reaches the target. With the whole palette hidden the page's open frame is 23 ms, so no single remaining piece is left to remove cheaply.

Costs while closed (no palette mounted, so nothing added)

Idle rAF deltas 4 s at rest (kd-idle, 12 runs): base 25.0 ms median, branch 24.0, max 26 vs 28. List scroll with the palette closed (3 s programmatic scroll of the notes list, kg-scroll, 12 runs; selector fixed): base 23.5 / max 36, branch 24.0 / max 29. Unchanged. Nothing is mounted at idle, so there is no GPU memory or paint-flash change to check.

Look

Palette open on the notes page, base vs branch, 1440 x 968, real Safari, light and dark: mean absolute pixel difference 0.027 / 0.024 of 255 (light: max 13, 665 px above 6; dark: 84 px above 6, caret or note-text sampling). Screenshots below (base-*, kc-*).

Not done / pending

  • iPhone 18 Pro sim ⌘K check: the sim is on the Studio host and the Mac lock was busy with other lanes; phone ⌘K does not show the preview pane (!phone), so the phone change is only the unchanged open path. I can run it on request.
  • Functional palette specs on dev-01 (palette-frames, palette-app-words, glass-portal, sheets-leak, search-preview, palette-apps, palette-app-icons, indexing) are queued behind the slot line; result will follow as a comment.
**#1054 ⌘K round 3 (option 3 + 2): improved, target (< 33 ms) NOT reached. Branch `perf/stalls-1054-kc`, head `5b5ed4623` (tree of `8069bdd08`), off `review/calendar-2` `b4b1e9693`. Best number: open worst-frame median 73 to 45 ms; one long frame remains. Your call whether to merge it.** Real Safari 26.5.2 on macos-01, production builds with `rm -rf dist`, paired A/B in one session (fresh page per sample, alternating order), 20 runs, Mac lock held, only runs after 15:31 UTC (and one 19:14 to 19:21 UTC pair discarded, since J480 had a Mac build window then). ## Change (two commits) * `e7c4264b1`: a note's preview draws only the blocks that fill the pane (`fitCount`, guess 760 px) at once and the rest in 12-block pieces at idle (from 450 ms on); with words typed everything is drawn at once so hits are marked and scrolled to as before. * `8069bdd08`: the preview pane (`.preview`) mounts two animation frames after the open and fades in over 110 ms (no empty flash); `container-type: size` only on flat previews (a file's page uses `cqh`); the note preview's glass keeps its tint, inner shade and edge but not a second `backdrop-filter` (the palette's own glass is already blurring behind it). Rejected on measurement: words drawn one frame after the pane (worse: worst median 71 ms, 2nd-worst 38), the earlier pre-mounts and blur ramps. ## ⌘K open, base vs branch (worst frame, 20 runs each) | page | base median / max | branch median / max | branch runs ≤ 50 ms | frames > 33 per run (base / branch, ≤ 1 over) | |---|---|---|---|---| | Settings, run 1 (`kd-k`) | 74.5 / 345 | 45.0 / 171 | 12/20 | 19/20 / 17/20 | | Settings, run 2 (`kg-k`) | 73.0 / 220 | 43.5 / 258 | 12/20 | 19/20 / 13/20 | | Notes page, run 2 (`kg-k2`) | 87.0 / 652 | 52.5 / 687 | 10/20 | 14/20 / 11/20 | (the notes-page control with the same build twice varied 50 to 85 ms between sessions, so treat that row as about 35 ms better, not exact.) The open is now two medium frames (typical 26 to 40 ms, then 29 to 78 ms) instead of one 75 to 90 ms frame, but the second is still over 33 ms and no run set reaches the target. With the whole palette hidden the page's open frame is 23 ms, so no single remaining piece is left to remove cheaply. ## Costs while closed (no palette mounted, so nothing added) Idle rAF deltas 4 s at rest (`kd-idle`, 12 runs): base 25.0 ms median, branch 24.0, max 26 vs 28. List scroll with the palette closed (3 s programmatic scroll of the notes list, `kg-scroll`, 12 runs; selector fixed): base 23.5 / max 36, branch 24.0 / max 29. Unchanged. Nothing is mounted at idle, so there is no GPU memory or paint-flash change to check. ## Look Palette open on the notes page, base vs branch, 1440 x 968, real Safari, light and dark: mean absolute pixel difference 0.027 / 0.024 of 255 (light: max 13, 665 px above 6; dark: 84 px above 6, caret or note-text sampling). Screenshots below (`base-*`, `kc-*`). ## Not done / pending * iPhone 18 Pro sim ⌘K check: the sim is on the Studio host and the Mac lock was busy with other lanes; phone ⌘K does not show the preview pane (`!phone`), so the phone change is only the unchanged open path. I can run it on request. * Functional palette specs on dev-01 (palette-frames, palette-app-words, glass-portal, sheets-leak, search-preview, palette-apps, palette-app-icons, indexing) are queued behind the slot line; result will follow as a comment.
Author
Owner

#1054 ⌘K round 3, addendum on the specs (branch perf/stalls-1054-kc, head 446ed1e59 = 5b5ed4623 plus one test edit).

Functional run on dev-01 Chromium under ~/bin/slot of the palette specs against the branch before the test edit: 80 passed, 14 failed.

  • 6 failures in glass-portal.spec.ts: 90 s timeouts in page.reload (host load; same class as the fonts.ready timeout seen earlier on calendar-2).
  • 8 failures in search-preview.spec.ts ("the preview is glass", 1440 x 900, all backdrops): the spec requires the pane's glass to have the same backdrop-filter as the palette's, which is exactly what this change removes (no second blur layer). 446ed1e59 updates it: same tint, and no second blur layer. This is a deliberate change of the "one glass" rule for this pane; say so if you want it kept and I will drop the blur removal instead.
    I queued a re-run of search-preview and glass-portal (workers 1) at 22:10 CET but dev-01's six slots were held by long jobs for 3 hours and it never started, so I stopped it per the 3 h rule. The edited spec has not been run. Re-run tests/search-preview.spec.ts tests/glass-portal.spec.ts --project=chromium before merging.
**#1054 ⌘K round 3, addendum on the specs (branch `perf/stalls-1054-kc`, head `446ed1e59` = `5b5ed4623` plus one test edit).** Functional run on dev-01 Chromium under `~/bin/slot` of the palette specs against the branch before the test edit: 80 passed, 14 failed. * 6 failures in `glass-portal.spec.ts`: 90 s timeouts in `page.reload` (host load; same class as the `fonts.ready` timeout seen earlier on calendar-2). * 8 failures in `search-preview.spec.ts` ("the preview is glass", 1440 x 900, all backdrops): the spec requires the pane's glass to have the same `backdrop-filter` as the palette's, which is exactly what this change removes (no second blur layer). `446ed1e59` updates it: same tint, and no second blur layer. **This is a deliberate change of the "one glass" rule for this pane; say so if you want it kept and I will drop the blur removal instead.** I queued a re-run of `search-preview` and `glass-portal` (workers 1) at 22:10 CET but dev-01's six slots were held by long jobs for 3 hours and it never started, so I stopped it per the 3 h rule. The edited spec has not been run. Re-run `tests/search-preview.spec.ts tests/glass-portal.spec.ts --project=chromium` before merging.
Author
Owner

#1054: ⌘K preview change merged into review/calendar-2 (fast-forward, head b78f50dd6) and calendar-2 redeployed.

Targeted specs, search-preview, glass-portal, chrome, on dev-02 (a free slot; dev-01 queued for hours) against branch head before the final rebase (f2b668f89):

  • chromium: 97 passed, 1 failed; webkit: 93 passed, 5 failed.
  • The chromium failure and one webkit failure are search-preview "1440x900 dark busy: the pane's glass is the same tint as the palette's". It fails on the unchanged calendar-2 base too (chromium 3/3, webkit 4/4, same cause: the two adaptive glasses get a slightly different tint over the busy backdrop), so it is pre-existing and not caused by this change.
  • The other 4 webkit failures are glass-portal 90 s timeouts (page.evaluate/reload) on dev-02 under load; the same tests passed in chromium (and in WebKit the other 12 cases passed). Not re-run.

Known limit: the open of the palette is now two medium frames instead of one long one: worst-frame median 73 to 45 ms (Settings page, two paired 20-run sets in real Safari) and about 87 to 52 ms on the notes page; typical first frame 26 to 40 ms, second 29 to 78 ms. The target (< 33 ms) is not met; accepted as the known limit for now. Idle and list scroll with the palette closed are unchanged (25.0 vs 24.0 ms and 23.5 vs 24.0 ms at the median).

**#1054: ⌘K preview change merged into `review/calendar-2` (fast-forward, head `b78f50dd6`) and calendar-2 redeployed.** Targeted specs, `search-preview`, `glass-portal`, `chrome`, on dev-02 (a free slot; dev-01 queued for hours) against branch head before the final rebase (`f2b668f89`): * chromium: **97 passed, 1 failed**; webkit: **93 passed, 5 failed**. * The chromium failure and one webkit failure are `search-preview` "1440x900 dark busy: the pane's glass is the same tint as the palette's". **It fails on the unchanged calendar-2 base too** (chromium 3/3, webkit 4/4, same cause: the two adaptive glasses get a slightly different tint over the busy backdrop), so it is pre-existing and not caused by this change. * The other 4 webkit failures are `glass-portal` 90 s timeouts (page.evaluate/reload) on dev-02 under load; the same tests passed in chromium (and in WebKit the other 12 cases passed). Not re-run. **Known limit:** the open of the palette is now two medium frames instead of one long one: worst-frame median 73 to 45 ms (Settings page, two paired 20-run sets in real Safari) and about 87 to 52 ms on the notes page; typical first frame 26 to 40 ms, second 29 to 78 ms. The target (< 33 ms) is not met; accepted as the known limit for now. Idle and list scroll with the palette closed are unchanged (25.0 vs 24.0 ms and 23.5 vs 24.0 ms at the median).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#1054
No description provided.