16 KiB
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. Every change is written to be light; a release that breaks a budget below does not ship, however useful its features are.
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 (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). 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
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
Budgets are checked by a full benchmark before each major release (X.0.0; other stables and betas run no probes): every probe below, on a release build, on the reference machine, with the results recorded in the budgets table above. Single changes are not measured, unless the user asks; a release that fails a budget is fixed before it ships, and the probes below (with --features profile) find the cause.
- 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 blockis the time each move holds the UI thread, close to the cost of the frame it causes;IDLE cpuis 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. - Champion table hover:
powershell.exe -ExecutionPolicy Bypass -File scripts/hover-probe.ps1 -Title "Arena Tracker"from WSL, with the « Statistiques » tab showing the table under the default band (adjust-Topand-Bottomotherwise). The app opens on « Défi »: open « Statistiques » first, as the band targets its table. After an idle phase, it posts synthetic mouse moves across table rows 240 times per second without touching the real cursor. CompareHOVER cpuwithIDLE cpu;HOVER pingshows 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 withARENA_TRACKER_PROFILE=<file.csv>(from WSL, pass it throughWSLENV, e.g.WSLENV=ARENA_TRACKER_PROFILE/p:ARENA_TRACKER_HIDE). Every second it appends the frames GPUI drew (draw: total,request_layout,prepaint,paintin 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(both tabs), then for « Statistiques »statistics-title(the page title),tiles,placements,completed,attempts(the three charts keep their height),tabs,table, and for « Défi »banner(the banner, on the home and during a champ select: ring, Season, counter-title, its two lines and the splash; it replaceshome-header, and is notbanners, the status messages),home-tools(the heading row: title, count, filters and search),cards(the card grid), and during an Arena champ selectanvil(the Anvil champions heading and row, which take the place ofhome-toolsandcards), thenothers(the « Autres champions » section: its header and, when open, its search and grid). - Memory: working set of
arena-tracker.exein Task Manager, orGet-Process arena-trackerin 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. The charts row is a cached view (#31), and « Défi » never renders it (a structural test guards that too). The home's card grid is the second (#72) and the « Autres champions » grid, while the section is open, the third: their size comes from their style, and structural tests check that hovering outside it does not render its cards and that hovering or scrolling it recomputes no statistics. Each card grid reads its portraits through its own image cache, never GPUI's app-wide one, and keeps only those of the cards it paints (#77): structural tests check that scrolling drops the others, from the GPU atlas too, and that hovering outside the grid drops none; a grid that stops being shown (the home grid under « Statistiques » or during a champ select, the Anvil champions row once it ends) gives all its portraits back. The banner's ring is the fourth (#84), as wide as the window width gives: structural tests check that hovering or scrolling the grid draws it again only for the tick that lights up or goes out, that drawing it alone neither draws the grid nor builds a card, and that its fixed shapes are tessellated once per set of ticks and size, a hover tessellating only the lit tick and a scroll that moves it none. The banner decodes its splash itself, never through GPUI's app-wide cache, one at a time on GPUI's low-priority queue at below-normal thread priority: structural tests check that it holds two at most (the one shown and the one decoding; a splash asked for meanwhile waits), gives back the one replaced, from the GPU atlas too, and holds none under « Statistiques », behind « Paramètres » (with the grids' portraits), scrolled out of view in a low window, or without an illustration. 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. A view that is not cached renders again with its parent and saves nothing, while its state must be kept in sync; a window move bypasses every cache.
GPUI and gpui-component are not modified to meet a budget: the app's own rendering cost is the lever (ADR-0004).
Animations and splashes
The identity (ring, banner, animations; docs/interface.md) follows the same rule:
- Animations are triggered by an event (end of a followed Match, champ select entering or leaving, an ally's confirmation, card hover, tab change) and draw nothing at rest. No timer or loop keeps a frame going once an animation is over, and none runs while the window is hidden or minimised. They follow the Windows « Show animations » setting.
- The foundation (
crates/app/src/motion.rs, with the page saying when « Défi » is visible, #86) decides whether the app animates, and when. The Windows setting reaches GPUI'sApp::reduce_motion: gpui-base reads it at start, and the window's ownWM_SETTINGCHANGEforSPI_SETCLIENTAREAANIMATIONreads it again, with no polling. When it is off, a tab switch shows its end state at once, and an animation asked for is not played; turning it off ends a transition running and drops the animation waiting, as soon as Windows says so (AnimationSetting). An animation asked for while « Défi » is not visible (window minimised or hidden in the notification area, « Statistiques », « Paramètres » or a champ select in front) waits inDeferred: only the strongest is kept, it plays once when « Défi » shows again, and a champ select that starts abandons it. - Tab transitions lay a veil, never move the screen. A cached view's cache key holds its bounds and its opacity, so fading or sliding the screen itself would draw the grid, the ring and the charts again at every frame and build the cards again. The veil, of the page's background, covers the screen leaving (130 ms) then lifts off the one arriving (280 ms). Each frame is asked for by the transition itself (
on_next_frame), and none once the veil is lifted. A window hidden during a transition ends it at once. The champion table is a cached view too, laid out by the space the page gives it, so the veil's frames do not draw it. The screen arriving is prepared (its rows copied and sorted, its cards built) only when it is shown, so a switch undone under the veil prepares nothing. Structural tests check that a transition draws neither the grid, the ring nor the table again, builds no card, recomputes no statistics, and asks for no frame at rest. The charts arriving play gpui-kit's own short entry, as after any switch. - A card hovered is drawn over its grid, which stays cached (#88). The cards of a grid never change on hover or focus: the page draws the card under the pointer or the keyboard (and those settling back) lifted over the grid, in a deferred layer painted after the page, from where the grid last placed it (
card_lift.rs). The grid records its visible cards' bounds and indices while it lays out its rows, so drawing them over it reads no layout, searches no card and copies none: the lifted card is the grid's card as it is at each frame. The layer covers each lifted card's place with the page's background, and in the hand lays the veil on the other cards. Each frame is asked for by the page's render while a card moves (request_animation_frame), and none once they are still. A wheel drops the grid's lifted cards at once, even at either end of the list, and so does a grid no longer shown (the home under a champ select, the hand after it) or a card filtered out, so no frame is asked for a card no longer drawn; a tab switch or « Paramètres » drops them all, and a hidden window or the setting turned off shows their end state at once. Structural tests check that hovering a card, through its whole animation, draws none of the grid, builds no card and computes no statistics, and that no frame is asked for at rest. A zoomed illustration overflows the card and is cut square by GPUI's rectangular clip: a frame of the page's background rounds its corners again, which nicks the gold glow by a few pixels at each corner. - A champ select enters and leaves over its cached hand (#87). The entry starts once the window shows it, not behind « Paramètres »: a band of gold light (four two-stop gradients side by side, GPUI's gradients have two stops) crosses the page in 900 ms, the title comes in rising in 700 ms, and the Anvil champions are dealt from the bottom of the window, the first at 380 ms then one every 110 ms, each in 700 ms. The cards dealt, the card an ally just took (it rests 8 px lower in the hand, and goes down there as it greys) and the cards leaving at the end are drawn by the page over the hand's grid, in a deferred layer that covers their places with the page's background, from where the grid last placed them (
stage.rs), as the lifted cards are: the grid is never drawn again for them, and a card's reasons changing during the deal show on it without dealing again. The hand's cards come with the statistics, loaded at each new champ select: they are dealt from when they come. A card still dealt is lifted once in its place: until a frame finds it there, the card waited for asks for frames itself. A card out of sight (the hand scrolled out of a low window, a card still under the window's bottom edge) is not built. At the end, the hand leaves (320 ms per card, from the last, 35 ms apart), each card from where it was, read once when the champ select ends (its place in the deal, its lift, the hand's veil, an ally's confirmation not over), then the veil of the tabs covers the champ select from 240 ms and the end is applied under it: the home is prepared only then. Each frame is asked for by the motion itself, none once it is over or while the hand waits for its cards; a hidden window, the page covered or the setting turned off shows the end state at once. Structural tests on the Arena capture pilot the sequence step by step and check that it draws the hand's grid again for no frame, builds no card, sorts nothing and computes no statistics, and asks for no frame at rest. - The end of a followed Match is drawn over the cached ring, the cached grid and the banner (#89). The comet, the flaring tick and the bouncing crown are a function of the page's render in a layer over the ring (
Ring::match_layer): the ring is not drawn again, and the comet and the tick are built at each frame only while the animation runs, unlike the ring's own shapes, built once per set of ticks; the crown is the ring's own, moved. The card that changes is drawn over its grid like a lifted card at rest (card_lift.rs), and stays in the grid until the animation ends even if the filter leaves it out. With the pointer on the grid, nothing moves under it: the grid of the new statistics (order, cards, filter) is prepared when they arrive, and the pointer leaving only puts it in place. The banner's counter rolls in painted over its place in the title, and the splash of the champion validé settles in with the banner's own decode. The animation is fixed when it starts (tick, duration) and reads no statistics at each frame; each frame is asked for by the page's render while it runs, and none after. Structural tests check that it draws neither the grid nor the ring again, tessellates no crown, builds no card, recomputes no statistics and asks for no frame at rest, and that leaving a grid it held still sorts nothing and builds no card. - Two splashes decoded at most: the one shown and the one replacing it. All splashes are downloaded in the background, at low priority, after the card portraits, and kept on disk.
- During champ select, the Anvil grid is cached at the height of its card rows. The capture replay checks that a splash fade builds no cards and that traversing the hand and « Autres champions » keeps at most two decoded splashes. The latest hovered card takes over when the current fade finishes.
- The ring is a cached view, laid out from its style alone. A structural test guards it: hovering a card, scrolling the grid or an animation on another part does not render the ring; only a change of what it shows (the champions' state, their order, the selection) or its own animation does. Its gain is checked at the next release benchmark.