From 8de0aa24d9b09b3dff9e3378222877cbfff41ae0 Mon Sep 17 00:00:00 2001 From: Tyler Date: Mon, 10 Aug 2026 10:53:10 -0500 Subject: [PATCH] perf(desktop): probe the Windows shell environment concurrently (#5878) Co-authored-by: tsouth89 --- .../desktop/src/shell/DesktopShellEnvironment.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/desktop/src/shell/DesktopShellEnvironment.ts b/apps/desktop/src/shell/DesktopShellEnvironment.ts index f1b252f29c8f1cfe0abb8ccf0a0a9db96bfeb4fd..bd8aa6654f79c38804a127753568be59d197e0ce 100644 --- a/apps/desktop/src/shell/DesktopShellEnvironment.ts +++ b/apps/desktop/src/shell/DesktopShellEnvironment.ts @@ -379,10 +379,18 @@ const installWindowsEnvironment = Effect.fn("desktop.shellEnvironment.installWin function* ( config: ShellEnvironmentConfig, ): Effect.fn.Return { - const noProfile = yield* readWindowsEnvironment(["PATH"], { loadProfile: false }); - const profile = yield* readWindowsEnvironment(WINDOWS_PROFILE_ENV_NAMES, { - loadProfile: true, - }); + // Concurrent, not sequential: these two probes are independent (only their + // results are combined below) and each spawns its own PowerShell. Run in + // series they sit at offset 0 of desktop.startup, before anything else, and + // launch traces measured them at 2718ms then 2066ms — the entire 4.8s + // startup span, of which desktop.bootstrap is ~30ms. + const [noProfile, profile] = yield* Effect.all( + [ + readWindowsEnvironment(["PATH"], { loadProfile: false }), + readWindowsEnvironment(WINDOWS_PROFILE_ENV_NAMES, { loadProfile: true }), + ], + { concurrency: 2 }, + ); const mergedPath = mergePaths("win32", [ trimNonEmpty(profile.PATH), trimNonEmpty(knownWindowsCliDirs(config.env).join(";")), -- 2.54.0