authorgravatar for tyler@southboundsoftware.comTyler <tyler@southboundsoftware.com> 2026-08-10 10:53:10-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-08-10 11:53:10-04:00
log8de0aa24d9b09b3dff9e3378222877cbfff41ae0
treef28f30633caa81a4275b9d450716ebc0ac841f94
parentcad2c93616a7c25110670c151a816d5c68341bd4
signature Signed by PGP key B5690EEEBB952194

perf(desktop): probe the Windows shell environment concurrently (#5878)

Co-authored-by: tsouth89 <tsouth89@users.noreply.github.com>

1 files changed, 12 insertions(+), 4 deletions(-)

apps/desktop/src/shell/DesktopShellEnvironment.ts+12-4
...@@ -379,10 +379,18 @@ const installWindowsEnvironment = Effect.fn("desktop.shellEnvironment.installWin...@@ -379,10 +379,18 @@ const installWindowsEnvironment = Effect.fn("desktop.shellEnvironment.installWin
379 function* (379 function* (
380 config: ShellEnvironmentConfig,380 config: ShellEnvironmentConfig,
381 ): Effect.fn.Return<void, never, ChildProcessSpawner.ChildProcessSpawner> {381 ): Effect.fn.Return<void, never, ChildProcessSpawner.ChildProcessSpawner> {
382 const noProfile = yield* readWindowsEnvironment(["PATH"], { loadProfile: false });382 // Concurrent, not sequential: these two probes are independent (only their
383 const profile = yield* readWindowsEnvironment(WINDOWS_PROFILE_ENV_NAMES, {383 // results are combined below) and each spawns its own PowerShell. Run in
384 loadProfile: true,384 // series they sit at offset 0 of desktop.startup, before anything else, and
385 });385 // launch traces measured them at 2718ms then 2066ms — the entire 4.8s
386 // startup span, of which desktop.bootstrap is ~30ms.
387 const [noProfile, profile] = yield* Effect.all(
388 [
389 readWindowsEnvironment(["PATH"], { loadProfile: false }),
390 readWindowsEnvironment(WINDOWS_PROFILE_ENV_NAMES, { loadProfile: true }),
391 ],
392 { concurrency: 2 },
393 );
386 const mergedPath = mergePaths("win32", [394 const mergedPath = mergePaths("win32", [
387 trimNonEmpty(profile.PATH),395 trimNonEmpty(profile.PATH),
388 trimNonEmpty(knownWindowsCliDirs(config.env).join(";")),396 trimNonEmpty(knownWindowsCliDirs(config.env).join(";")),