Zed Editor Adds 3ms Latency to All Apps on KDE Wayland

A developer used a Teensy microcontroller to measure click-to-photon latency on Linux, discovering that an open Zed editor window adds 3ms of latency to all applications, even when idle. The finding came from comparing a desktop and laptop with identical NixOS configs—the desktop was consistently 3ms slower until the user created a fresh account and narrowed the culprit to Zed. This does not affect fullscreen games, but it impacts desktop responsiveness.

Measurement Setup

The author built a latency testing tool using a Teensy acting as a USB HID mouse, paired with a light sensor on the screen. The setup logs hundreds of samples to CSV automatically. Tests were run on two machines: a desktop and a laptop, both with Ada-generation RTX GPUs and Zen 4 CPUs, using NixOS with KDE Wayland 6.6.4, Proton-GE 10-33, MangoHud 0.8.2, and Nvidia driver 595.58.03. The display was an LG C1 at 120Hz over HDMI. They also tested Windows 11 on the same hardware for comparison.

LG Display Settings

  • Black Frame Insertion (BFI) adds exactly one frame (8.33ms at 120Hz) of delay. The author notes this is disappointing because BFI could be implemented without extra buffering.
  • HDR adds a tiny but measurable delay.
  • PC mode vs other input modes made no difference.
  • HDMI Auto Low Latency Mode (ALLM) is not supported on Linux, and Nvidia's Windows driver also lacks an option to enable it.

Game Tests

Doom Eternal (Vulkan)

Running through XWayland, the only difference between Linux and Windows is a wider tail at the 75th percentile. V-Sync enabled with FPS uncapped causes frame buffering, increasing latency. Disabling V-Sync recovers that latency (no tearing because XWayland). VRR and Nvidia-exclusive Windows settings had no significant impact.

Borderlands 3 (DX11, DX12)

Windows consistently had lower latency, especially with V-Sync. Using native Proton Wayland (PROTON_ENABLE_WAYLAND=1) reduces the gap. DX12 is slower on both platforms. Key findings:

  • VKD3D_SWAPCHAIN_LATENCY_FRAMES=1 for DX12 helps but still lags behind DX11.
  • VKD3D_SWAPCHAIN_IMAGES=2 and DXVK latency settings had no effect.
  • Capping FPS below refresh rate eliminates queueing and is the biggest improvement.

Hades 2 (DX12)

Similar behavior: capping at/below refresh rate, using wine_wayland, and VKD3D_SWAPCHAIN_LATENCY_FRAMES=1 help. However, with wine_wayland at fixed refresh rate, VKD3D_SWAPCHAIN_LATENCY_FRAMES=1 capped frame rate at half refresh.

Recommendations for Low Latency Gaming on Linux

  • Use wine_wayland / PROTON_ENABLE_WAYLAND=1.
  • Use late FPS limiting (e.g., MangoHud's late method).
  • For DX12 games, set VKD3D_SWAPCHAIN_LATENCY_FRAMES=1.
  • Enable VRR if the game has unstable frame pacing.
  • Avoid leaving Zed (or similar apps) open while gaming.

Network Gaming Over 2.5GbE

Using USB/IP for input forwarding, latency matched local results (0.3ms RTT). Moonlight for input only also matched. Adding egress delay on the Sunshine host did not affect Moonlight input latency. However, the full Moonlight round trip (click → Moonlight → Sunshine → Moonlight → display) showed a regression in kernel 7.0 (video stream never starting, with a simple workaround). Windows delivered slightly lower latency overall, possibly due to DWM vs KWin differences.

KWin Deep Dive

The author instrumented KWin to understand why it adds latency compared to DWM. A frame capture showed:

  • Chromium's input-to-present latency was 9.78ms.
  • KWin budgeted 3ms for compositing but overestimated by 2.39ms, plus a 1.34ms safety margin.
  • Removing all slack would give a lower bound of 3.07ms from input to page flip.

When KWin is busy with another client (e.g., a fullscreen game), the compositor can delay other windows. This explains the Zed editor effect: its frame queueing trains the compositor to be pessimistic, adding latency to all other apps.

Config Snippet for FPS Limiting

# Using MangoHud with late FPS limit
mangohud --fps-limit=118 --fps-limit-method=late %command%

Why It Matters

For Linux gamers and desktop users, this article provides concrete, measurable evidence of software-induced latency. The discovery that a background editor can add 3ms to all apps is a practical tip. The KWin analysis and Proton/Wayland tuning recommendations are actionable for improving gaming responsiveness.