mirror of
https://github.com/zed-industries/zed.git
synced 2026-07-09 16:00:35 +00:00
Moves the crash handler subprocess spawn off the main thread to speed up startup, especially on Windows where process creation is slower. Previously `crashes::init` did part of its work synchronously when it was *called*, including `spawn_crash_handler`, which launches the `zed --crash-handler` child process (a synchronous `CreateProcessW` on Windows). Because `init` is evaluated inline as the argument to `background_executor().spawn(crashes::init(...))` in `main.rs`, that subprocess spawn ran on the main thread during startup rather than on the executor. This PR makes `connect_and_keepalive` a fully `async fn`, so all of that work, including the subprocess spawn, now runs on the background executor instead of blocking the main thread. I don't have a Windows machine to capture before/after numbers, but the crash handler spawn is clearly on the startup critical path. Logs in the Windows slow startup reports show it taking ~100–700ms between `spawning crash handler process` and `connected to crash handler process` (e.g. #40621, #54856), all of which previously blocked the main thread. Related to #49442 Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Improved startup performance |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| LICENSE-GPL | ||