Fix choppy window dragging on a 240 Hz Windows display #17
Notifications
Due Date
No due date set.
Depends on
#31 Bring a full frame of the statistics page under 2 ms
nessar/arena-tracker
Reference: nessar/arena-tracker#17
Reference in new issue
Block a user
Parent
#1
Reported problem
Dragging the Arena Tracker window across the user's 240 Hz screen feels visibly choppy. The user confirms that dragging File Explorer on the same screen is smooth. The complaint concerns moving the whole application window, not just scrolling inside the champion table.
The actual frame rate has not been measured and the cause is not established. Do not treat the report as proof of a hard-coded 60 Hz limit.
Reproduction
Expected behaviour
Moving the Arena Tracker window feels as smooth and responsive as moving File Explorer on that display, at its configured refresh rate.
Acceptance criteria
Investigation context
The app uses
gpui-kit = "=0.9.1", withgpui-pre-windows0.3.12 in the current lockfile. Window options incrates/app/src/main.rsdo not set a refresh rate.The installed Windows backend has a separate move/resize path in
events.rs:handle_size_move_loopinstalls aSetTimerusingUSER_TIMER_MINIMUM, andhandle_timer_msgprocesses queued work and paints. It also has a compositor-based VSync path invsync.rs. These are investigation leads, not confirmed causes; also check whether application work blocks the UI thread.The user suggested hardware acceleration as an additional investigation lead. Verify which rendering backend and GPU adapter the application actually uses on Windows, and whether rendering is hardware-accelerated or falling back to software. If acceleration is unavailable or disabled, investigate enabling or restoring it and measure whether this improves window dragging. Do not assume acceleration is currently disabled or that enabling it alone will resolve the stutter.
Follow ADR-0002 and ADR-0003: keep the existing GPUI architecture and use the native Windows build workflow. Any dependency change must be deliberate and reproducible through the repository, not an edit to the local Cargo cache.
Mesures et cause (2026-11-16/17)
Conditions : portable de référence (AMD Ryzen 5 7640U, Radeon 760M intégrée, 32 Go), écran interne 2256×1504 à 60 Hz (l'écran 240 Hz n'était pas branché), Windows 11 build 26300, client LoL ouvert donc suivi et import en arrière-plan actifs. Mesures faites avec
scripts/move-probe.ps1: 240 déplacements programmatiques par seconde, sans toucher à la souris, avec une phase de repos avant.Accélération matérielle : active. Le processus rend sur le moteur 3D de la Radeon 760M (pilote AMD chargé), pas sur WARP (rendu logiciel). Ce n'est pas la cause.
Build debug contre release :
scripts/win run)scripts/prod run)Au repos, après le démarrage : 0,3–1,4 % d'un cœur, pas de boucle de rendu.
Cause : GPUI redessine toute la fenêtre à chaque
WM_MOVE(son traitement du déplacement appellerefresh(), qui ignore le cache des vues), sur le thread d'interface qui fait aussi tourner la boucle de déplacement de Windows. Une image complète de la page coûte 5 à 7 ms en release sur ce GPU, soit plus qu'une image à 240 Hz (4,2 ms). En debug, non optimisé, elle coûte des dizaines de millisecondes.Comparaison contrôlée : avec un patch de GPUI qui supprime ce redessin quand seule la position change, le même scénario donne 240/240 déplacements, 1,2 ms au p95 et 2–4 % de CPU, en release comme en debug. La cause est donc confirmée.
Décision
Le patch n'est pas conservé (ADR-0004, sur la branche
worktree-issue-17-window-drag) : la même modification a été refusée en amont (zed-industries/zed#66745), car une vue peut lire les dimensions de la fenêtre pendant son rendu ; garder une copie modifiée de GPUI serait une maintenance permanente. À la place, c'est le coût d'une image complète de la page qui doit descendre sous 2 ms (règle n°1,docs/performance.md) : #27 mesure la répartition, #31 allège la page. Ce ticket est bloqué par #31.Ajouté sur la branche :
scripts/move-probe.ps1(mesure),scripts/prod build|run(build de production à utiliser au quotidien et pour mesurer ; le debug reste non optimisé),docs/performance.md(règle n°1 et budgets), ADR-0004.Reste à faire pour fermer ce ticket
Une fois #31 terminé : sur le PC de bureau avec l'écran 240 Hz, lancer
scripts/prod run, déplacer la fenêtre par sa barre de titre et comparer avec l'Explorateur de fichiers, puis vérifier le redimensionnement et le tableau ; noter le résultat ici. La sonde ne couvre pas la vraie boucle de déplacement de Windows, d'où cette vérification à la main.Closing. Cause found above: GPUI redraws the whole page on every move. It is fixed by making a full frame cheaper (#31, PR #40) instead of patching GPUI (ADR-0004).
On this ticket's 240 Hz desktop, after #31, drawing a frame during moves takes 1.57 ms at p50 and 2.50 ms at p99, plus 0.22 ms of presentation. That is under one 240 Hz frame (4.2 ms). MOVE ping p99 went from 3.03 ms to 1.88–1.93 ms.
A real title-bar drag next to File Explorer, and checking resize and the table by hand, move to the release benchmark (#32). Reopen if dragging still stutters.