Add a hover probe and measure where a full frame of the statistics page goes #27

Closed
opened 2026-11-17 01:26:05 +01:00 by nessar · 2 comments
Owner

Parent

#1

What to build

A way to see where a full frame of the statistics page spends its time, so that making it cheaper (rule #1, budget 1: at most 2 ms per frame) starts from measurements rather than guesses.

Today a full frame costs 5–7 ms on a release build on the reference machine (docs/performance.md). It is redrawn whenever the window moves (GPUI's move handling bypasses cached views, #17) and whenever the hovered row of the champion table changes (no part of the page is a cached view). Measured during #17 by posting synthetic mouse moves across the table rows, 240 per second, without touching the real cursor:

Build Cost of one hovered-row change UI thread while hovering
Release (scripts/prod run) one full frame of 5–7 ms 9 % of one core
Debug (scripts/win run) one full frame of 34–39 ms saturated, 100 % of one core

This ticket delivers the hover probe as a repository tool and the breakdown of a full frame; it does not optimise anything.

Acceptance criteria

  • A hover probe in the repository, next to the move probe: it posts synthetic mouse moves across the champion table without moving the real cursor, measures how long the UI thread is held and the CPU used compared with an idle phase, and prints the machine and build it measured like the move probe.
  • The hover probe is documented in docs/performance.md, under how to measure.
  • The cost of a full frame on a release build on the reference machine is broken down by part of the page (the tiles, each chart, the champion table, text layout and shaping, presentation), with the method used, and recorded on this ticket.
  • The breakdown says which parts are worth reducing first to reach 2 ms, and whether any is a fixed cost of GPUI that the app cannot reduce.
  • GPUI and gpui-component are not modified (ADR-0004); measurement aids that stay in the app are switched off in release builds or removed.

Context

  • GPUI has a profiler feature with a frame journal, which may give per-frame timings without changes to GPUI.
  • The champion table is virtualized: only the visible rows (about 15–20) are built per frame.
  • Rule #1 and its budgets: docs/performance.md. Measure on release builds; debug numbers never count.

Blocked by

None — can start immediately.

## Parent #1 ## What to build A way to see where a full frame of the statistics page spends its time, so that making it cheaper (rule #1, budget 1: at most 2 ms per frame) starts from measurements rather than guesses. Today a full frame costs 5–7 ms on a release build on the reference machine (`docs/performance.md`). It is redrawn whenever the window moves (GPUI's move handling bypasses cached views, #17) and whenever the hovered row of the champion table changes (no part of the page is a cached view). Measured during #17 by posting synthetic mouse moves across the table rows, 240 per second, without touching the real cursor: | Build | Cost of one hovered-row change | UI thread while hovering | | --- | --- | --- | | Release (`scripts/prod run`) | one full frame of 5–7 ms | 9 % of one core | | Debug (`scripts/win run`) | one full frame of 34–39 ms | saturated, 100 % of one core | This ticket delivers the hover probe as a repository tool and the breakdown of a full frame; it does not optimise anything. ## Acceptance criteria - [ ] A hover probe in the repository, next to the move probe: it posts synthetic mouse moves across the champion table without moving the real cursor, measures how long the UI thread is held and the CPU used compared with an idle phase, and prints the machine and build it measured like the move probe. - [ ] The hover probe is documented in `docs/performance.md`, under how to measure. - [ ] The cost of a full frame on a release build on the reference machine is broken down by part of the page (the tiles, each chart, the champion table, text layout and shaping, presentation), with the method used, and recorded on this ticket. - [ ] The breakdown says which parts are worth reducing first to reach 2 ms, and whether any is a fixed cost of GPUI that the app cannot reduce. - [ ] GPUI and gpui-component are not modified (ADR-0004); measurement aids that stay in the app are switched off in release builds or removed. ## Context - GPUI has a `profiler` feature with a frame journal, which may give per-frame timings without changes to GPUI. - The champion table is virtualized: only the visible rows (about 15–20) are built per frame. - Rule #1 and its budgets: `docs/performance.md`. Measure on release builds; debug numbers never count. ## Blocked by None — can start immediately.
nessar added the ready-for-agent label 2026-11-17 01:26:05 +01:00
nessar added a new dependency 2026-11-17 01:26:11 +01:00
nessar self-assigned this 2026-11-17 19:23:04 +01:00
Author
Owner

Implementation: branch perf/27-hover-probe-frame-breakdown (commit 64b1d3b), PR below.

Breakdown of a full frame: desktop, for information only

These were taken on the desktop (Ryzen 7 7800X3D, RX 7800 XT, 3840x2160 @ 240 Hz, window 1920x1290 px at 150 %), which is not the reference laptop, while the PC was in use. The build is a release build with --features profile, so the times come from GPUI's profiler. Each run: real data, game client closed, 15 s of loading, then the hover probe with 5 s idle and 5 s of hovering. The frames analysed are the 5 s of hovering.

Variant (ARENA_TRACKER_HIDE) Frames/s Frame p50 / p99 request_layout prepaint paint present Hover CPU
main without profiler (reference) – – – – – – 73 %
full page 240 2.16 / 2.77 0.31 0.95 0.79 0.22 65 %
without the 3 charts 239 2.12 / 2.77 0.34 1.18 0.49 0.18 67 %
without the table 48 0.89 / 1.25 0.19 0.25 0.46 0.20 5 %
without tiles and banners 240 2.40 / 2.99 0.31 1.15 0.83 0.23 56 %
without header and tabs 240 2.06 / 2.55 0.21 1.00 0.77 0.22 50 %

All times are in ms. The phase columns are p50 values.

Reading

  • Champion table: about 1.3 ms of the 2.2 ms frame (60 %), mostly in prepaint. GPUI attributes 0.63 ms of prepaint per frame to the table view alone. It is the first part to reduce.
  • Three charts: about 0.3 ms, all of it paint (0.79 → 0.49 ms).
  • Header (drop-downs, buttons) and tabs: about 0.1 ms of layout (0.31 → 0.21 ms).
  • Tiles and banners: within the noise.
  • Presentation: a fixed 0.2 ms per frame (present, i.e. GPUI and DirectX submitting the frame). The app cannot reduce it.
  • Text layout and shaping cannot be isolated by removal. GPUI reuses the lines shaped in the previous frame, so the cost of shaping spreads over each part. A sampling profiler would be needed.
  • First to reduce to reach 2 ms on the laptop (5–7 ms per frame there):
    1. What the table rebuilds on each hovered row.
    2. Redrawing everything else on each hover. Nothing on the page is a cached view today, so hovering one row also rebuilds the charts, tiles and header, about 0.9 ms here.
Implementation: branch `perf/27-hover-probe-frame-breakdown` (commit 64b1d3b), PR below. ## Breakdown of a full frame: desktop, for information only These were taken on the desktop (Ryzen 7 7800X3D, RX 7800 XT, 3840x2160 @ 240 Hz, window 1920x1290 px at 150 %), which is not the reference laptop, while the PC was in use. The build is a release build with `--features profile`, so the times come from GPUI's profiler. Each run: real data, game client closed, 15 s of loading, then the hover probe with 5 s idle and 5 s of hovering. The frames analysed are the 5 s of hovering. | Variant (`ARENA_TRACKER_HIDE`) | Frames/s | Frame p50 / p99 | request_layout | prepaint | paint | present | Hover CPU | | --- | --- | --- | --- | --- | --- | --- | --- | | main without profiler (reference) | – | – | – | – | – | – | 73 % | | full page | 240 | 2.16 / 2.77 | 0.31 | 0.95 | 0.79 | 0.22 | 65 % | | without the 3 charts | 239 | 2.12 / 2.77 | 0.34 | 1.18 | 0.49 | 0.18 | 67 % | | without the table | 48 | 0.89 / 1.25 | 0.19 | 0.25 | 0.46 | 0.20 | 5 % | | without tiles and banners | 240 | 2.40 / 2.99 | 0.31 | 1.15 | 0.83 | 0.23 | 56 % | | without header and tabs | 240 | 2.06 / 2.55 | 0.21 | 1.00 | 0.77 | 0.22 | 50 % | All times are in ms. The phase columns are p50 values. **Reading** - **Champion table: about 1.3 ms of the 2.2 ms frame (60 %), mostly in `prepaint`.** GPUI attributes 0.63 ms of `prepaint` per frame to the table view alone. It is the first part to reduce. - **Three charts: about 0.3 ms, all of it paint** (0.79 → 0.49 ms). - **Header (drop-downs, buttons) and tabs: about 0.1 ms of layout** (0.31 → 0.21 ms). - **Tiles and banners: within the noise.** - **Presentation: a fixed 0.2 ms per frame** (`present`, i.e. GPUI and DirectX submitting the frame). The app cannot reduce it. - **Text layout and shaping cannot be isolated by removal.** GPUI reuses the lines shaped in the previous frame, so the cost of shaping spreads over each part. A sampling profiler would be needed. - **First to reduce to reach 2 ms on the laptop** (5–7 ms per frame there): 1. What the table rebuilds on each hovered row. 2. Redrawing everything else on each hover. Nothing on the page is a cached view today, so hovering one row also rebuilds the charts, tiles and header, about 0.9 ms here.
nessar added the performance label 2026-11-17 20:12:37 +01:00
Author
Owner

Closing. The hover probe and the profile build are merged (PR #37), and the desktop breakdown is recorded above. Rule #1 changed in 28319fc: single changes are no longer measured; a full benchmark on the reference laptop checks every budget before each major release. The breakdown on the laptop is folded into that benchmark, tracked in #32.

Closing. The hover probe and the profile build are merged (PR #37), and the desktop breakdown is recorded above. Rule #1 changed in 28319fc: single changes are no longer measured; a full benchmark on the reference laptop checks every budget before each major release. The breakdown on the laptop is folded into that benchmark, tracked in #32.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: nessar/arena-tracker#27