Fix choppy window dragging on a 240 Hz Windows display #17

Closed
opened 2026-11-16 12:56:14 +01:00 by nessar · 2 comments
Owner

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

  1. Launch the Windows application on the user's 240 Hz screen.
  2. Drag the window by its title bar across that screen.
  3. Compare with dragging File Explorer on the same screen: Arena Tracker stutters while File Explorer is smooth.

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

  • Reproduce the difference on Windows and record the actual display refresh setting, GPU, build profile and whether background import is running. Compare debug and release builds to establish whether the build profile contributes.
  • Identify the cause using measurements or a controlled comparison, and record the evidence on this ticket.
  • Fix the cause and verify that dragging the window on the same 240 Hz screen is smooth compared with File Explorer, using the same before/after scenario.
  • Check that resizing and normal table interactions still work, and that the change does not introduce continuous unnecessary rendering or a busy loop while the app is idle.
  • Add a focused regression check where the changed logic can be tested; record the manual Windows result because core tests alone cannot establish display smoothness.

Investigation context

The app uses gpui-kit = "=0.9.1", with gpui-pre-windows 0.3.12 in the current lockfile. Window options in crates/app/src/main.rs do not set a refresh rate.

The installed Windows backend has a separate move/resize path in events.rs: handle_size_move_loop installs a SetTimer using USER_TIMER_MINIMUM, and handle_timer_msg processes queued work and paints. It also has a compositor-based VSync path in vsync.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.

## 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 1. Launch the Windows application on the user's 240 Hz screen. 2. Drag the window by its title bar across that screen. 3. Compare with dragging File Explorer on the same screen: Arena Tracker stutters while File Explorer is smooth. ## 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 - [ ] Reproduce the difference on Windows and record the actual display refresh setting, GPU, build profile and whether background import is running. Compare debug and release builds to establish whether the build profile contributes. - [ ] Identify the cause using measurements or a controlled comparison, and record the evidence on this ticket. - [ ] Fix the cause and verify that dragging the window on the same 240 Hz screen is smooth compared with File Explorer, using the same before/after scenario. - [ ] Check that resizing and normal table interactions still work, and that the change does not introduce continuous unnecessary rendering or a busy loop while the app is idle. - [ ] Add a focused regression check where the changed logic can be tested; record the manual Windows result because core tests alone cannot establish display smoothness. ## Investigation context The app uses `gpui-kit = "=0.9.1"`, with `gpui-pre-windows` 0.3.12 in the current lockfile. Window options in `crates/app/src/main.rs` do not set a refresh rate. The installed Windows backend has a separate move/resize path in `events.rs`: `handle_size_move_loop` installs a `SetTimer` using `USER_TIMER_MINIMUM`, and `handle_timer_msg` processes queued work and paints. It also has a compositor-based VSync path in `vsync.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.
nessar added the ready-for-agent label 2026-11-16 12:56:14 +01:00
nessar added a new dependency 2026-11-17 01:26:11 +01:00
Author
Owner

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 :

Build Déplacements tenus (sur 240/s) Temps par déplacement, p95 CPU pendant le déplacement
Debug (scripts/win run) 14–15 ~100 ms (médiane ~75 ms) 76–86 % d'un cœur
Release (scripts/prod run) 219–232 5,2–7,8 ms 28–36 % d'un cœur
Explorateur de fichiers 230–240 1,8–4,4 ms —

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 appelle refresh(), 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.

## 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** : | Build | Déplacements tenus (sur 240/s) | Temps par déplacement, p95 | CPU pendant le déplacement | | --- | --- | --- | --- | | Debug (`scripts/win run`) | 14–15 | ~100 ms (médiane ~75 ms) | 76–86 % d'un cœur | | Release (`scripts/prod run`) | 219–232 | 5,2–7,8 ms | 28–36 % d'un cœur | | Explorateur de fichiers | 230–240 | 1,8–4,4 ms | — | 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 appelle `refresh()`, 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.
nessar added the performance label 2026-11-17 20:12:37 +01:00
Author
Owner

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.

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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: nessar/arena-tracker#17