Repository navigation
Description
Problem
With "WSL only" turned on, the desktop app takes 13 s from launch to the first usable screen when WSL is already running. With the Windows backend the same build on the same machine takes 4.2 s. For the first 9.7 s the user sees only a small "Connecting to WSL..." window, then an empty white main window for another 3.3 s.
After wsl --terminate it is 19.4 s and after wsl --shutdown 21.9 s; the extra there is WSL's own start and is not what this issue is about. The 9 s gap with WSL already up is the app's own sequencing.
Steps to reproduce
- Windows with WSL2 and an Ubuntu distro. Install the desktop build.
- Settings, Connections, WSL backend: turn it on and choose "WSL only". Quit the app.
- Make sure the distro is running (
wsl -d Ubuntu -- true), start the app once so the WSL runtime is installed, quit again. - Start the app and time from process start to the welcome screen (or the last open thread).
- Turn "WSL only" off and repeat.
I timed it by starting the app with --remote-debugging-port and polling the renderer's DOM every 50 ms until the welcome screen's text and buttons were present. Per-step times come from desktop.trace.ndjson.
Numbers
Windows Server 2025, 4 vCPU (Xeon Platinum 8370C), 16 GB, NTFS, Defender on with default settings, WSL2 Ubuntu 24.04, desktop nightly 0.1.10-nightly.20261114.4709 (commit dfd2187). Milliseconds from process start to first usable screen.
| Mode | Median (min to max) | Runs |
|---|---|---|
| Windows backend | 4,182 (4,102 to 4,306) | 5 |
| WSL backend added next to Windows, WSL running | 5,193 (4,958 to 6,251) | 5 |
| WSL only, WSL already running | 13,016 (12,768 to 13,163) | 4 |
WSL only, after wsl --terminate Ubuntu |
19,446 (19,153 to 20,360) | 3 |
WSL only, after wsl --shutdown |
21,868 (21,544 to 21,876) | 3 |
The first WSL-only launch after installing a build took 23.4 s (10.8 s of it unpacking the runtime into the distro); that one-time cost is excluded above.
One WSL-only launch with WSL running, start offset and duration in ms:
| Start | Duration | Span |
|---|---|---|
| 679 | 456 | desktop.wsl.preWarm |
| 1,139 | 4,606 | desktop.backendConfiguration.wslPreflight |
| 1,227 | 2,276 | desktop.wsl.prepareRuntime (desktop.wsl.runRuntimeInstall) |
| 3,503 | 2,241 | desktop.wsl.probeRuntime |
| 5,745 | 183 | desktop.wsl.getDistroIp |
| 5,956 | 3,761 | DesktopBackendManager.waitForReady |
| 9,716 | backend ready, main window created | |
| about 13,000 | first usable screen |
The same launch with the Windows backend: main window with the logo splash at about 1.5 s, waitForReady from 639 for 2,661 ms, usable at about 4.2 s.
Where the 9 s go
- Two runtime checks in a row, 4.5 s.
prepareRuntimeruns the install script, whose ready check executest3 --versionon the staged runtime and hashes the entry (buildWslRuntimeInstallScript).probeRuntimethen runst3 --versionagain in a login shell (probeWslRuntimeImpl). They run one after the other in runWslPreflight, on every launch, for a runtime that is already installed. In the distro on its own,t3 --versionof the staged runtime takes 843 to 1,471 ms (n=5),sha256sumof it 155 to 171 ms, and awsl.exeround trip 116 to 123 ms. - Readiness polling in 1 s steps. While the server is not yet listening, each
GET http://<distro ip>:3773/.well-known/t3/environmenttakes 1,006 and 1,004 ms to fail (a refused connection to the WSL address costs about a second on Windows), so the app notices readiness up to a second late. The successful request took 275 ms. - The renderer starts only after the backend is ready. With the Windows backend the main window opens at 1.5 s and the renderer boots while the server starts. (fix(desktop): load the renderer while the backend starts #28715 made that so.) In WSL-only mode the main window is created at 9.7 s, so its roughly 3.3 s boot is added on top instead of overlapping, and it shows an empty white window rather than the splash.
Expected
With WSL already running, WSL-only launch should be close to the 5.2 s that the same WSL backend takes when it is added next to the Windows one: check an already-installed runtime once, not twice, and load the main window while the backend starts.
Not covered
No GPU on this machine, so nothing here is about paint or compositor time. The numbers are start-up sequencing only.
Activity