Draw the champion table and the charts more cheaply (#31)
CI / core (pull_request) Successful in 1m12s

The champion table is now the app's own view, a uniform_list with one
plain element per cell, instead of gpui-component's DataTable, which
gave each row a horizontal virtual list and each cell its own layout,
id and accessibility node. A full frame of the statistics page costs a
third less: on the manual checks machine, drawing it went from 2.37 to
1.57 ms at the median and from 3.72 to 2.50 ms at the 99th percentile.
Sorting by header click, scrolling, click-to-select (now following the
champion through sorts and reloads), stripes and hover stay; dragging
column edges, arrow-key selection and screen-reader table roles go.
Columns shrink with a narrow window, clipped, with room left for the
scrollbar; an ellipsis cost 0.2 ms per frame.

The charts row is a cached view of fixed height, so hovering a row no
longer paints the charts again (about 0.1 ms at the median, 0.2 ms at
the 99th percentile). A structural test guards it, with GPUI's own test
support as a dev-dependency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nessarandClaude Opus 5.5 committed 2026-11-17 22:17:07 +01:00
1 parent 2c1dde684c
commit 8318a5875e
5 files changed
+828 -184

No files matched your search

+3 -3
View File
@@ -10,13 +10,13 @@ Measured on the **reference machine**, on a **release build** (`scripts/prod run
| # | Budget | Limit | Current value | Status |
| --- | --- | --- | --- | --- |
| 1 | Interactions (hover, scroll, sort, filter, moving or resizing the window): cost of one frame | at most **2 ms** at the 99th percentile, aiming for 1 ms | 5–7 ms for a full frame of the statistics page; a window move redraws one, 5–8 ms per move at the 95th percentile | over budget |
| 1 | Interactions (hover, scroll, sort, filter, moving or resizing the window): cost of one frame | at most **2 ms** at the 99th percentile, aiming for 1 ms | 5–7 ms for a full frame of the statistics page; a window move redraws one, 5–8 ms per move at the 95th percentile (before #31) | over budget; to re-measure since #31 |
| 2 | Idle, window visible: CPU | at most **0.5 %** of one core on average | 0.3–1.4 % (about 0.8 %) | over budget |
| 3 | Window minimised or hidden | **no rendering**, CPU close to 0, outside an import | not measured | unknown |
| 4 | Memory, with the full page loaded (every champion and portrait) | at most **150 MB** working set | 120 MB working set, 99 MB private | within budget |
| 5 | Background work (import, following the game client) | threads at **low priority**, never more than **one core** | not measured | unknown |
Current values measured on 2026-11-16 and 2026-11-17 (issue #17).
Current values measured on 2026-11-16 and 2026-11-17 (issue #17). For information, #31 made a full frame about a third cheaper on the manual checks machine (drawing it: 2.37 → 1.57 ms at the median, 3.72 → 2.50 ms at the 99th percentile, plus 0.22 ms of presentation); its value here is still to measure.
### Ratchet
@@ -37,6 +37,6 @@ Every change that touches rendering, background work or memory measures before a
- **Champion table hover**: `powershell.exe -ExecutionPolicy Bypass -File scripts/hover-probe.ps1 -Title "Arena Tracker"` from WSL, with the statistics page showing the table under the default band (adjust `-Top` and `-Bottom` otherwise). After an idle phase, it posts synthetic mouse moves across table rows 240 times per second without touching the real cursor. Compare `HOVER cpu` with `IDLE cpu`; `HOVER ping` shows how long input waits behind the UI thread while hovering (budget 1). The default band is `-X 0.25 -Top 0.62 -Bottom 0.95 -Step 0.04` (fractions of the client area, about one row per move in a window at least 800 px tall). Leave the real cursor still over the window, outside the table: when it is outside the window, GPUI sees each synthetic move as the mouse entering then leaving, and refreshes the whole window, bypassing cached views.
- **Where a frame goes**: build with `scripts/prod build --features profile` (never for everyday use) and start the app with `ARENA_TRACKER_PROFILE=<file.csv>` (from WSL, pass it through `WSLENV`, e.g. `WSLENV=ARENA_TRACKER_PROFILE/p:ARENA_TRACKER_HIDE`). Every second it appends the frames GPUI drew (`draw`: total, `request_layout`, `prepaint`, `paint` in ms), their presentation (`present`) and the views' own time (`view`, recorded by GPUI from 0.5 ms). `ARENA_TRACKER_HIDE=<parts>`, read at start, removes parts of the page so that a part's cost is the difference with the full page under the hover probe: `header`, `banners`, `tiles`, `placements`, `completed`, `attempts` (the three charts keep their height), `tabs`, `table`.
- **Memory**: working set of `arena-tracker.exe` in Task Manager, or `Get-Process arena-tracker` in PowerShell, once the page is fully loaded.
- **CI cannot check budgets**: its runner is Linux without a GPU, and the app only builds on Windows (ADR-0003). When a change relies on cached views to stay within budget, a structural test (for example, "hovering the table does not render the charts") guards it instead of a timed test.
- **CI cannot check budgets**: its runner is Linux without a GPU, and the app only builds on Windows (ADR-0003). When a change relies on cached views to stay within budget, a structural test (for example, "hovering the table does not render the charts") guards it instead of a timed test. The charts row is the page's one cached view (#31). A cached view is laid out from its style alone, never its content, so only a part whose size does not depend on its content can be one.
GPUI and gpui-component are not modified to meet a budget: the app's own rendering cost is the lever (ADR-0004).