Perf gate: Low Power Mode (iPhone sim + CPU-limited WebContent + 6× throttle) #625

Open
opened 2026-10-19 14:19:37 +00:00 by kayg · 3 comments
Owner

kayg (2026-10-19): one of the best UI performance tests is the iPhone in Low Power Mode — real iPhones' performance drops hard there. Example: the tasks mockup's right pane opening/closing was laggy on kayg's device.
Plan: a standard "low power" perf gate for every UI change before merge/deploy:

  1. iPhone simulator with Low Power Mode on (Settings → Battery) — check whether the simulator honours it (frame rate cap / throttling); record.
  2. Approximate device throttling on the Mac: limit the simulator's WebContent process CPU (taskpolicy -b background QoS, or cpulimit to ~30–40%) while measuring rAF deltas and input-to-first-frame.
  3. Chromium CDP CPU throttling 6× as a second proxy.
  4. Budgets (first motion ≤ 1 frame, no frame > 16.7 ms; 60 Hz) must hold under these; report numbers per interaction.
  5. Final confirmation on kayg's real phone in Low Power Mode.
    First target: the tasks right pane open/close, the Composer morph, menu morphs, sheet open/close, table row ops.
kayg (2026-10-19): one of the best UI performance tests is the iPhone in Low Power Mode — real iPhones' performance drops hard there. Example: the tasks mockup's right pane opening/closing was laggy on kayg's device. Plan: a standard "low power" perf gate for every UI change before merge/deploy: 1. iPhone simulator with Low Power Mode on (Settings → Battery) — check whether the simulator honours it (frame rate cap / throttling); record. 2. Approximate device throttling on the Mac: limit the simulator's WebContent process CPU (taskpolicy -b background QoS, or cpulimit to ~30–40%) while measuring rAF deltas and input-to-first-frame. 3. Chromium CDP CPU throttling 6× as a second proxy. 4. Budgets (first motion ≤ 1 frame, no frame > 16.7 ms; 60 Hz) must hold under these; report numbers per interaction. 5. Final confirmation on kayg's real phone in Low Power Mode. First target: the tasks right pane open/close, the Composer morph, menu morphs, sheet open/close, table row ops.
Author
Owner

Budget decided (kayg): 8.3 ms per frame (120 fps) is the target; 16.7 ms (60 fps) is the hard floor, including under Low Power Mode. Reports list frames > 8.3 ms and frames > 16.7 ms per interaction.

Budget decided (kayg): 8.3 ms per frame (120 fps) is the target; 16.7 ms (60 fps) is the hard floor, including under Low Power Mode. Reports list frames > 8.3 ms and frames > 16.7 ms per interaction.
Author
Owner

Deploy 4: https://preview.calternal.cloud/tasks.html. kayg's desktop and device notes: ring, resizable panes, nested tint, Matrix, priority colours, and the first low-power pass on the task pane (also for #625).

Fixed

  • No ring after a mouse. The dropped/open Board card had an accent outline; an open task is now only tinted (accent), a ring is for keyboard focus only (:focus-visible).
  • One surface a row/card. The inner title button had its own hover (.press) tint and press scale on top of the row's, which drew the second, square-edged rectangle. The row (List, Matrix) or the card (Board) owns hover, press and selected; the button inside draws nothing. Test tests/tasks-surfaces.spec.ts: in rest, hover, pressed, selected and keyboard focus, for List, Board, Matrix, the sidebar and the notes list, light and dark, at most ONE element with a background under the pointer inside a row/card (chips and the checkbox are marks); keyboard focus is a ring and never a fill; no ring after a mouse. 8 pass.
  • Resizable panes (desktop). Drag the sidebar | middle and middle | right boundaries: 8 pt hit zone, col-resize, a thin hover line, double-click resets (springs; a drag follows 1:1), arrows nudge 16, widths remembered on this device, every layout incl. Board (in Board the edge moves the task pane). Bounds: sidebar 200-360, middle >= 320, right >= 360 (the Notes shell has 180-320 and 260-460; I used your numbers). One width write a frame; the transition is off while dragging and for two frames after (WebKit eased the last step otherwise). Playwright (Chromium + WebKit): clamps, memory, reload, reset, keyboard, Board edge, no ring.
  • Matrix. Four equal quadrants fill the pane (1100/1440/1920 asserted), each scrolls inside. Phone: stacked, equal (default) or &matrix=grid 2 x 2 (stacked reads better at 390: cards keep a line of title). Cards drag like the Board (the same dnd.svelte.ts); a drop sets priority and urgency: Do = High+ and due within 2 days, Plan = High+ and not urgent, Quick = urgent and below High, Later = neither (the date moves to today / +3 days), the changed chips spring, and the card stays in the list for the visit. Test passes (all four quadrants, ghost gone, chips pop).
  • Priority colours. Priorities are now None, Low, Medium, High, Urgent, with our own icons (chevrons up/up/bars/down) and semantic colour on icon and text: Urgent red, High amber, Medium blue, Low grey (Matrix quadrant dots use the same). Contrast measured from the drawn pixels of the chip, light/dark on List glass, Matrix card and phone sky: every one >= 4.8:1 (lowest: light phone sky Urgent 4.81; List light 5.03-5.51; dark 5.3-8.4). tests/tasks-matrix.spec.ts.

Right pane open/close (the cause and the fix)

  • Desktop slide: the middle and right panes animated flex-basis, so the middle pane re-laid out its whole list every frame. The layout now takes its final shape ONCE (opening: at the start; closing: at the end) and the page slides on the compositor (transform + opacity inside the pane, which never changes size mid-motion). Layouts per open: 8 -> 3; per close: 4-6 -> 1. During a resize drag, panes' widths are set inline (not as root custom properties, which restyled everything).
  • Phone push/pop: the task page is now mounted at pointer-down, so a tap only slides it (first frame after the tap 45 -> 7 ms in the simulator, worst frame 28 -> 18 ms on the cold first open); the + and mic leave at once instead of fading (their glass would blur the moving page for a fade). The remaining per-interaction cost is the bar's size spring (one layout a frame, the shared capsule) and style recalcs of running transitions.

Low-power measurement (what could and could not be done)

  • iPhone simulator Low Power Mode: no setting exists for the simulator and WebKit there does not honour it (not testable).
  • Background QoS on this device's WebContent processes only (taskpolicy -b, 76 processes, restored with -B -t 0 -l 0 afterwards; no other process touched): the fixed JS loop barely slows (7 -> 10 ms) but WebKit throttles rAF to ~5 fps (frames 214 ms), so it is not a usable stand-in for LPM's 30 fps and slower CPU. Throughput tiers -t/-l 2,4,5 changed nothing on an idle Mac. Numbers from it are not meaningful; I did not use them.
  • Used instead: Chromium with CDP CPU x6 (main-thread cost of every motion; the headless raster is software so frame times there are not a GPU's), and the simulator normally (60 Hz, 16-17 ms is a frame).

Chromium CPU x6, main thread per interaction (x6 values; divide by 6 for a normal CPU), before = deployed Deploy 3, after = this build:

Interaction layouts before -> after style (ms) script (ms)
desktop open task (slide in) 8 -> 3 32 -> 47 59 -> 89 (mount now at pointer-down)
desktop close 6 -> 1 25 -> 21 4 -> 4
desktop picker open / close 10 / 4 -> 9 / 4 58 / 82 -> 56 / 70 35 / 52 -> 56 / 43
desktop composer palette open / close 1 / 4 -> 1 / 4 17 / 8 -> 8 / 7 70 / 24 -> 83 / 27
desktop Board drag (40 moves + drop) 5 -> 5 146 -> 163 253 -> 213
desktop resize drag (90 moves) n/a -> 160 (116 recalcs) -> 184, 85 layouts (3.4 ms each at x6)
phone push / pop 23-28 -> 28 / 24 163 / 151 -> 165 / 145 118 / 63 -> 124 / 57
phone layout menu open / pick n/a -> 28 / 27 58 / 63 43 / 60
phone picker open / close n/a -> 21 / 24 113 / 149 67 / 47
phone composer open n/a -> 22 168 137

Simulator (real WebKit, 60 Hz, this build), per interaction: first frame after input / worst frame / frames over 16.7 ms. At 60 Hz every frame is 16.7 ms, so "frames over 8.3 ms" cannot be told apart in the simulator (all of them); the 120 Hz question is answered by the main-thread cost above, per frame at normal speed: resize drag ~0.5 ms layout + 0.4 ms style a frame, Board drag ~1 ms a frame between the lift and the drop.

Interaction first frame worst > 16.7 ms
open task / back (push, pop) 7 / 6 ms 18 / 17 0 / 0
layout menu open / pick 1 / 1 ms 17 / 17 0 / 0
picker open / close 9 / 5 ms 17 / 18 0 / 0
tick 6 ms 17 0
composer open (keyboard on focus) 49 ms 33 after the first frame (the first is 150-300 ms: the soft keyboard) 2
Board drag, 4 runs today (hold, lift, 30 moves, drop, settle) n/a 25-35 at the lift frame, 17 elsewhere 1
  • Not within budget: the Board/Matrix lift frame is 21-35 ms in today's simulator runs (the deployed Deploy 3 build measures 19-24 in the same session, and the same code measured 17-19 earlier today, so the simulator's own noise is about +/-10 ms); and the first frame after tapping a text field (keyboard). Not measured: a real iPhone, in or out of Low Power Mode. I could not reproduce the pane lag in any engine here, so the fixes above remove the known main-thread work (relayout per frame, mounting inside the slide, fading glass over a moving page) rather than a measured culprit; it needs a check on the phone, ideally with the Safari Web Inspector timeline, in Low Power Mode.
**Deploy 4: https://preview.calternal.cloud/tasks.html**. kayg's desktop and device notes: ring, resizable panes, nested tint, Matrix, priority colours, and the first low-power pass on the task pane (also for #625). **Fixed** - **No ring after a mouse.** The dropped/open Board card had an accent outline; an open task is now only tinted (accent), a ring is for keyboard focus only (`:focus-visible`). - **One surface a row/card.** The inner title button had its own hover (`.press`) tint and press scale on top of the row's, which drew the second, square-edged rectangle. The row (List, Matrix) or the card (Board) owns hover, press and selected; the button inside draws nothing. Test `tests/tasks-surfaces.spec.ts`: in rest, hover, pressed, selected and keyboard focus, for List, Board, Matrix, the sidebar and the notes list, light and dark, at most ONE element with a background under the pointer inside a row/card (chips and the checkbox are marks); keyboard focus is a ring and never a fill; no ring after a mouse. 8 pass. - **Resizable panes (desktop).** Drag the sidebar | middle and middle | right boundaries: 8 pt hit zone, `col-resize`, a thin hover line, double-click resets (springs; a drag follows 1:1), arrows nudge 16, widths remembered on this device, every layout incl. Board (in Board the edge moves the task pane). Bounds: sidebar 200-360, middle >= 320, right >= 360 (the Notes shell has 180-320 and 260-460; I used your numbers). One width write a frame; the transition is off while dragging and for two frames after (WebKit eased the last step otherwise). Playwright (Chromium + WebKit): clamps, memory, reload, reset, keyboard, Board edge, no ring. - **Matrix.** Four equal quadrants fill the pane (1100/1440/1920 asserted), each scrolls inside. Phone: stacked, equal (default) or `&matrix=grid` 2 x 2 (stacked reads better at 390: cards keep a line of title). Cards drag like the Board (the same `dnd.svelte.ts`); a drop sets priority and urgency: Do = High+ and due within 2 days, Plan = High+ and not urgent, Quick = urgent and below High, Later = neither (the date moves to today / +3 days), the changed chips spring, and the card stays in the list for the visit. Test passes (all four quadrants, ghost gone, chips pop). - **Priority colours.** Priorities are now None, Low, Medium, High, Urgent, with our own icons (chevrons up/up/bars/down) and semantic colour on icon and text: Urgent red, High amber, Medium blue, Low grey (Matrix quadrant dots use the same). Contrast measured from the drawn pixels of the chip, light/dark on List glass, Matrix card and phone sky: every one >= 4.8:1 (lowest: light phone sky Urgent 4.81; List light 5.03-5.51; dark 5.3-8.4). `tests/tasks-matrix.spec.ts`. **Right pane open/close (the cause and the fix)** - Desktop slide: the middle and right panes animated `flex-basis`, so the middle pane re-laid out its whole list every frame. The layout now takes its final shape ONCE (opening: at the start; closing: at the end) and the page slides on the compositor (transform + opacity inside the pane, which never changes size mid-motion). Layouts per open: 8 -> 3; per close: 4-6 -> 1. During a resize drag, panes' widths are set inline (not as root custom properties, which restyled everything). - Phone push/pop: the task page is now mounted at pointer-down, so a tap only slides it (first frame after the tap 45 -> 7 ms in the simulator, worst frame 28 -> 18 ms on the cold first open); the + and mic leave at once instead of fading (their glass would blur the moving page for a fade). The remaining per-interaction cost is the bar's size spring (one layout a frame, the shared capsule) and style recalcs of running transitions. **Low-power measurement (what could and could not be done)** - iPhone simulator Low Power Mode: no setting exists for the simulator and WebKit there does not honour it (not testable). - Background QoS on this device's WebContent processes only (`taskpolicy -b`, 76 processes, restored with `-B -t 0 -l 0` afterwards; no other process touched): the fixed JS loop barely slows (7 -> 10 ms) but WebKit throttles rAF to ~5 fps (frames 214 ms), so it is not a usable stand-in for LPM's 30 fps and slower CPU. Throughput tiers `-t/-l 2,4,5` changed nothing on an idle Mac. Numbers from it are not meaningful; I did not use them. - Used instead: Chromium with CDP CPU x6 (main-thread cost of every motion; the headless raster is software so frame times there are not a GPU's), and the simulator normally (60 Hz, 16-17 ms is a frame). Chromium CPU x6, main thread per interaction (x6 values; divide by 6 for a normal CPU), before = deployed Deploy 3, after = this build: | Interaction | layouts before -> after | style (ms) | script (ms) | | --- | --- | --- | --- | | desktop open task (slide in) | 8 -> 3 | 32 -> 47 | 59 -> 89 (mount now at pointer-down) | | desktop close | 6 -> 1 | 25 -> 21 | 4 -> 4 | | desktop picker open / close | 10 / 4 -> 9 / 4 | 58 / 82 -> 56 / 70 | 35 / 52 -> 56 / 43 | | desktop composer palette open / close | 1 / 4 -> 1 / 4 | 17 / 8 -> 8 / 7 | 70 / 24 -> 83 / 27 | | desktop Board drag (40 moves + drop) | 5 -> 5 | 146 -> 163 | 253 -> 213 | | desktop resize drag (90 moves) | n/a | -> 160 (116 recalcs) | -> 184, 85 layouts (3.4 ms each at x6) | | phone push / pop | 23-28 -> 28 / 24 | 163 / 151 -> 165 / 145 | 118 / 63 -> 124 / 57 | | phone layout menu open / pick | n/a -> 28 / 27 | 58 / 63 | 43 / 60 | | phone picker open / close | n/a -> 21 / 24 | 113 / 149 | 67 / 47 | | phone composer open | n/a -> 22 | 168 | 137 | Simulator (real WebKit, 60 Hz, this build), per interaction: first frame after input / worst frame / frames over 16.7 ms. At 60 Hz every frame is 16.7 ms, so "frames over 8.3 ms" cannot be told apart in the simulator (all of them); the 120 Hz question is answered by the main-thread cost above, per frame at normal speed: resize drag ~0.5 ms layout + 0.4 ms style a frame, Board drag ~1 ms a frame between the lift and the drop. | Interaction | first frame | worst | > 16.7 ms | | --- | --- | --- | --- | | open task / back (push, pop) | 7 / 6 ms | 18 / 17 | 0 / 0 | | layout menu open / pick | 1 / 1 ms | 17 / 17 | 0 / 0 | | picker open / close | 9 / 5 ms | 17 / 18 | 0 / 0 | | tick | 6 ms | 17 | 0 | | composer open (keyboard on focus) | 49 ms | 33 after the first frame (the first is 150-300 ms: the soft keyboard) | 2 | | Board drag, 4 runs today (hold, lift, 30 moves, drop, settle) | n/a | 25-35 at the lift frame, 17 elsewhere | 1 | - Not within budget: the Board/Matrix lift frame is 21-35 ms in today's simulator runs (the deployed Deploy 3 build measures 19-24 in the same session, and the same code measured 17-19 earlier today, so the simulator's own noise is about +/-10 ms); and the first frame after tapping a text field (keyboard). Not measured: a real iPhone, in or out of Low Power Mode. I could not reproduce the pane lag in any engine here, so the fixes above remove the known main-thread work (relayout per frame, mounting inside the slide, fading glass over a moving page) rather than a measured culprit; it needs a check on the phone, ideally with the Safari Web Inspector timeline, in Low Power Mode.
Author
Owner

Findings (2026-10-19, tasks.html work): the iOS simulator has no Low Power Mode and its WebKit ignores it; taskpolicy -b on the sim's WebContent drops rAF to ~5 fps (not a usable proxy); the sim runs at 60 Hz so the 8.3 ms target can't be verified there and sim frame times are noisy (±10 ms). Gate in practice: Chromium CDP 6× throttle + layouts-per-interaction counts + sim at normal speed; final verdict on kayg's iPhone in Low Power Mode (Safari Web Inspector timeline when possible).

Findings (2026-10-19, tasks.html work): the iOS simulator has no Low Power Mode and its WebKit ignores it; taskpolicy -b on the sim's WebContent drops rAF to ~5 fps (not a usable proxy); the sim runs at 60 Hz so the 8.3 ms target can't be verified there and sim frame times are noisy (±10 ms). Gate in practice: Chromium CDP 6× throttle + layouts-per-interaction counts + sim at normal speed; final verdict on kayg's iPhone in Low Power Mode (Safari Web Inspector timeline when possible).
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#625
No description provided.