Skip to content

perf(window-management): make AeroSpace workspace moves async#487

Closed
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-aerospace-async
Closed

perf(window-management): make AeroSpace workspace moves async#487
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-aerospace-async

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

Summary

  • Extracted AeroSpace workspace reconciliation into src/main/aerospace-workspace.ts.
  • Replaced synchronous execFileSync('aerospace', ...) calls from the launcher show path with async execFile-backed fire-and-forget work.
  • Added in-flight coalescing so repeated show/post-show requests produce at most one follow-up reconciliation while a run is active.
  • Added regression coverage for coalescing, missing aerospace binary behavior, and non-blocking slow-command behavior.

Why

showWindow() called moveWindowToCurrentAerospaceWorkspace() before showing/focusing the launcher and again shortly after show. That helper performed multiple synchronous CLI calls on the Electron main process, so slow aerospace startup/server responses could directly delay launcher visibility, focus, and menu-bar responsiveness.

Performance Evidence

Controlled fake aerospace command delay: 120 ms per invocation.

Before:

  • sync helper duration: 734 ms
  • zero-delay timer fired after: 734 ms

After:

  • requestMove() returned after: 0 ms
  • zero-delay timer fired after: 0 ms
  • background reconciliation idle after: 364 ms
  • command count: 3

Validation

  • node --test scripts/test-aerospace-workspace.mjs
  • /opt/homebrew/Cellar/node@22/22.22.3/bin/npm test (live Electron crash recovery self-skipped because Electron was not launchable here)
  • /opt/homebrew/Cellar/node@22/22.22.3/bin/npm run check:i18n (exits 0; existing Italian missing keys reported: settings.ai.whisper.vocabulary, settings.extensions.appSearchScope)
  • /opt/homebrew/Cellar/node@22/22.22.3/bin/npm run build:main
  • Codex LSP diagnostics for src/main: 0 errors

Risks

  • AeroSpace movement is now eventual rather than blocking before mainWindow.show(). The existing post-show reconciliation remains and coalesces with any in-flight pre-show request to preserve placement as closely as possible without holding the main process.
  • Non-ENOENT command failures remain transient and retry on later show requests, matching the previous behavior.

@JustYannicc JustYannicc changed the title [codex] Make AeroSpace workspace moves async perf(window-management): make AeroSpace workspace moves async Jul 3, 2026
@JustYannicc

Copy link
Copy Markdown
Collaborator Author

Superseded by consolidated upstream PR #534 (perf(mac): reduce native polling and async IO stalls), which carries this change together with the related macOS/native/audio/camera async IO performance fixes. Closing this source PR so review can continue on #534.

@JustYannicc JustYannicc closed this Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant