Make fluid and light the app's rule #1, with measurable budgets
docs/performance.md sets five budgets measured on the reference laptop on release builds (frame cost, idle CPU, hidden window, memory, background work), a ratchet that only lowers them, and how to measure. CLAUDE.md and the README point to it. ADR-0004 records that GPUI is not patched to fix the stutter of #17: upstream refused the same change (zed#66745), so the page's own rendering cost has to come down instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit was merged in pull request #33.
This commit is contained in:
1 parent
f31081b25d
commit
e13db17bcb
4 files changed
+74
No files matched your search
@@ -1,3 +1,11 @@
|
||||
## Rule #1: fluid and light
|
||||
|
||||
The app must stay as fluid and light as possible: it never feels slow and never makes the computer feel slow. This comes before features. Budgets, reference machine and how to measure: `docs/performance.md`.
|
||||
|
||||
- Any change that touches rendering, background work or memory measures before and after with the probes, on a release build (`scripts/prod`) on the reference machine, and records the numbers on its ticket. Debug numbers never count.
|
||||
- A change that exceeds a budget is not done. When a budget is beaten durably, lower it in `docs/performance.md` (ratchet); never raise it.
|
||||
- Do not modify GPUI or gpui-component to meet a budget: reduce the app's own rendering cost (ADR-0004).
|
||||
|
||||
## Agent skills
|
||||
|
||||
### Issue tracker
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
Application de bureau Windows qui suit les Parties d'Arena de League of Legends. Le vocabulaire du domaine est dans `CONTEXT.md` et les décisions d'architecture dans `docs/adr/`.
|
||||
|
||||
Règle n°1 : l'application reste fluide et légère, sans jamais donner l'impression de ralentir ni l'application ni l'ordinateur. Ses budgets mesurables (temps par image, CPU au repos, mémoire, travail de fond) et la façon de les mesurer sont dans `docs/performance.md`.
|
||||
|
||||
## Prérequis
|
||||
|
||||
- Windows avec la chaîne d'outils Rust (rustup), version 1.98 ou plus récente, accessible depuis WSL sous le nom `cargo.exe`.
|
||||
@@ -14,9 +16,12 @@ Depuis WSL, à la racine du dépôt :
|
||||
|
||||
- `scripts/win build` : compile l'application avec la chaîne d'outils Windows. Le dossier de build est `%LOCALAPPDATA%\arena-tracker\target`, sur le disque Windows. Les arguments supplémentaires sont transmis à cargo (par exemple `scripts/win build --release`).
|
||||
- `scripts/win run` : compile si besoin puis lance l'application ; la fenêtre « Arena Tracker » s'ouvre sur Windows.
|
||||
- `scripts/prod build` et `scripts/prod run` : la même chose en mode production (build `--release` optimisé, sans console). C'est ce mode qu'il faut utiliser au quotidien et pour mesurer : le build debug n'est pas optimisé et chaque image y prend des dizaines de millisecondes.
|
||||
|
||||
La première compilation de GPUI prend plusieurs minutes.
|
||||
|
||||
Pour mesurer la fluidité du déplacement de la fenêtre, sans toucher à la souris : `powershell.exe -ExecutionPolicy Bypass -File scripts/move-probe.ps1 -Title "Arena Tracker"` (ou `-Class CabinetWClass` pour comparer avec l'Explorateur de fichiers), l'application étant ouverte. Voir `docs/performance.md`.
|
||||
|
||||
## Icône
|
||||
|
||||
Le logo est `crates/app/assets/logo.svg`. L'icône Windows `crates/app/assets/icon.ico` en est dérivée et est intégrée à l'exécutable à la compilation (`crates/app/build.rs`) : l'Explorateur, la fenêtre et la barre des tâches l'affichent sans fichier à côté de l'exécutable. Après une modification du logo, régénérer l'icône avec ImageMagick, depuis `crates/app/assets` :
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
status: accepted
|
||||
---
|
||||
|
||||
# Reduce rendering cost instead of patching GPUI
|
||||
|
||||
GPUI redraws the whole window on every move: its move callback calls `refresh()`, which also bypasses cached views, so dragging the window rebuilds a full frame of the statistics page for every `WM_MOVE` (issue #17). Measured on the reference machine (`docs/performance.md`), such a frame costs 5–7 ms in a release build, more than a 240 Hz frame. A 20-line patch on a vendored copy of `gpui-pre` removed that refresh for moves that keep the window's size and made dragging as smooth as File Explorer. We do not keep it: GPUI and gpui-component stay unmodified, and we make a full frame of the page cheap enough (rule #1, at most 2 ms) that redrawing it on every move or hover no longer shows.
|
||||
|
||||
Upstream refused the same change on 2026-11-11 (zed-industries/zed#66745): any view may read the window's bounds during render, and the refresh keeps such views correct, so skipping it is unsound in general; the maintainer's answer to stuttering is to fix excessive render times. A vendored patch would therefore never go away, and every `gpui-kit` upgrade would have to re-vendor GPUI, re-apply the patch and re-check that nothing reads the window's position during render.
|
||||
|
||||
## Considered Options
|
||||
|
||||
- **Keep the vendored patch indefinitely**: smooth dragging at once, but permanent maintenance on a 100,000-line copy of a pre-1.0 framework that releases weekly.
|
||||
- **Keep the patch until a full frame is cheap enough**: smooth meanwhile, but the patch and its maintenance would stay for as long as that work takes, with no guarantee of an end.
|
||||
- **Reduce the page's rendering cost** (chosen): no fork, and it also fixes hover and every other redraw, not only moves.
|
||||
|
||||
## Consequences
|
||||
|
||||
- Until a full frame of the statistics page costs at most 2 ms, dragging the window still stutters on high refresh rate displays (issue #17 stays open, blocked by that work).
|
||||
- GPUI and gpui-component are never patched to meet a performance budget; if a budget cannot be met within the app, its floor is measured, explained and becomes the budget (ratchet, `docs/performance.md`).
|
||||
- If GPUI later tracks which views read the window's bounds, as its maintainer suggested, moves may stop redrawing upstream; nothing here prevents taking that upgrade.
|
||||
@@ -0,0 +1,40 @@
|
||||
# Rule #1: fluid and light
|
||||
|
||||
Arena Tracker must stay as fluid and as light as possible for its user: the app must never feel slow, and it must never make the computer feel slow. Nothing it does, in the foreground or in the background, may be excessive in CPU, memory or rendering.
|
||||
|
||||
This rule comes before features. A change that breaks a budget below is not done, however useful it is.
|
||||
|
||||
## Budgets
|
||||
|
||||
Measured on the **reference machine**, on a **release build** (`scripts/prod run`). Debug builds are unoptimised and their numbers never count.
|
||||
|
||||
| # | 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 |
|
||||
| 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).
|
||||
|
||||
### Ratchet
|
||||
|
||||
When a measurement shows a budget beaten durably, the limit is lowered to that level, and it is never raised again. Each gain becomes the new floor. Record the change in this table, with the date and the ticket.
|
||||
|
||||
## Machines
|
||||
|
||||
- **Reference machine**, where budgets are measured: laptop, AMD Ryzen 5 7640U with integrated Radeon 760M graphics, 32 GB, 2256×1504 display at 60 Hz. It is the weakest machine the app runs on: what passes here passes elsewhere.
|
||||
- **Manual checks machine**, for what the reference machine cannot show, such as a 240 Hz display: desktop, AMD Ryzen 7 7800X3D, Radeon RX 7800 XT, 32 GB DDR5, 240 Hz display. Its numbers are recorded for information, never as a criterion.
|
||||
|
||||
A measurement means something only with its machine and build: the probes print both before their results.
|
||||
|
||||
## Measuring
|
||||
|
||||
Every change that touches rendering, background work or memory measures before and after, with the same scenario, on the reference machine, and records the numbers on its ticket.
|
||||
|
||||
- **Window moves and idle CPU**: `powershell.exe -ExecutionPolicy Bypass -File scripts/move-probe.ps1 -Title "Arena Tracker"` from WSL, with the app open. It moves the window 240 times per second without touching the mouse, after an idle phase. `MOVE block` is the time each move holds the UI thread, close to the cost of the frame it causes; `IDLE cpu` is budget 2. Compare with File Explorer with `-Class CabinetWClass`. A real title-bar drag (Windows' modal move loop) is not covered: check it by hand.
|
||||
- **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.
|
||||
|
||||
GPUI and gpui-component are not modified to meet a budget: the app's own rendering cost is the lever (ADR-0004).
|
||||
Reference in new issue
Block a user