Repository navigation
perf(desktop): boot the renderer alongside the main bundle - #50108
Merged
Merged
Conversation
The first window's renderer used to start after every main-process layer was built and then waited on the IPC port before it could mount. createEarlyWindow now registers the oc:// handler, permissions, navigation policy and headers itself and calls loadURL in the tick the window is created, with the entry chunk kept Effect-free (the protocol handler reports through console until the logging layer installs a reporter). The window's argv carries firstLaunchPending and defaultServerUrl so the renderer mounts its shell without waiting on main; the locale is cached in localStorage for the same reason. Layer marks are reported with layers ready so the startup bench can attribute the time before the port.
Hona
added this pull request to stack #50115
September 20, 2026 06:13
jinhuang712
pushed a commit
to jinhuang712/opencode
that referenced
this pull request
Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bottom of a 7-PR stack that gets the desktop window from "visible" to "shell rendered" in ~210 ms instead of ~660 ms. Each layer is independently reviewable; the numbers below are for the whole stack.
oc://, permissions, navigation, headers; shell gate values in argvThis layer:
createEarlyWindowregisters theoc://handler, permissions, navigation policy and headers itself and callsloadURLin the same tick the window is created. The entry chunk stays Effect-free; the protocol handler reports throughconsoleuntil the logging layer installs a reporter. The window's argv carriesfirstLaunchPendinganddefaultServerUrlso the renderer can mount its shell without asking main; the locale is cached inlocalStoragefor the same reason.Packaged startup bench (
bun run bench:startup), Windows laptop display, warm service, 5 interleaved runs, medians in ms since spawn,v2vs the full stack:v2Window → shell: 664 → 210 ms. First pixels land ~50 ms later than before but as the complete hydrated frame; on stock Electron that instant is set by GPU shader compilation, which the renderer now finishes ahead of (electron/electron#54113 removes that wait).