Repository navigation
perf(desktop): only persist the background colour when it changes - #49770
Merged
Merged
Conversation
The renderer reports its theme background over IPC on every boot, and electron-store rewrites and fsyncs opencode.settings on each set. That blocked the main thread for ~40 ms while the renderer was waiting on IPC during startup, for a value that had not changed.
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.
Main-process CPU profile of a packaged launch, bottom-up from
fsync:DesktopEffectsin the renderer sends--background-baseon every boot (and on theme change).setBackgroundColorunconditionally calledgetStore().set(...), andelectron-storerewrites and fsyncs the whole settings file on each set — even when the value was already#121212. That's ~40 ms of blocked main thread exactly while the renderer is waiting on IPC for its persisted state, plus one disk write per launch.Measured with
bun run bench:startup(#49758): packagedv2build, isolated home, warm service, 6 launches, median.opencode.settingsrewritten per launch