perf: make loadCodePreviewSettings non-blocking in session_start#14
Open
monotykamary wants to merge 1 commit into
Open
perf: make loadCodePreviewSettings non-blocking in session_start#14monotykamary wants to merge 1 commit into
monotykamary wants to merge 1 commit into
Conversation
Fire-and-forget loadCodePreviewSettings().then() instead of await so the session_start handler returns immediately and doesn't block the serial extension runner dispatch. Tool renderer registration runs immediately without waiting for settings to load from disk.
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.
Summary
session_startcurrentlyawaitsloadCodePreviewSettings(), which reads up to 6 JSON settings files from disk. This blocks the serial extension runner dispatch — every extension after pi-code-previews must wait for those file reads to complete before its ownsession_starthandler can run.Changes
await loadCodePreviewSettings(ctx.cwd)→loadCodePreviewSettings(ctx.cwd).then(...)(fire-and-forget).then()callback (needs settings to be loaded)registerToolRenderersruns immediately — it doesn't depend on settings being loaded, and tool invocations will read settings lazily when calledImpact
Removes one
awaitfrom thesession_starthandler chain, allowing the extension runner to proceed to the next extension immediately. On its own this saves ~5ms, but cumulatively across all extensions this pattern eliminates serial blocking that adds up during session startup and resume.