perf(ai): batch stream IPC chunks - #537
Closed
JustYannicc wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
|
Superseded by #556, which consolidates this AI/native media performance batch. |
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.
What changed
ai-stream-chunksends on a short interval.ai-askandai-chatthrough the coalescer, with synchronous flushes beforeai-stream-done,ai-stream-error, cancellation cleanup, and same-request replacement.ai-cancelstill aborts them.Why
Renderer-side AI updates were already batched, but the main process still emitted one IPC event per provider chunk. Long streams could therefore produce hundreds of
ai-stream-chunkIPC messages even when renderer state commits were coalesced.Compatibility impact
Metrics
ai-stream-chunkIPC sends.ai-stream-chunkIPC send.How tested
On the clean PR branch from
origin/main:node --test scripts/test-ai-stream-ipc-batching.mjs-> 5 pass../node_modules/.bin/tsc -p tsconfig.main.json --noEmit-> pass.src/main/ai-stream-ipc.tsandsrc/main/main.ts-> no diagnostics.node --test 'scripts/test-*.mjs'-> 29 pass, 1 skipped.On the integration-stack worker branch before clean cherry-pick:
pnpm test-> 166 pass, 1 skipped live Electron test../node_modules/.bin/tsc -p tsconfig.main.json --noEmit-> pass../node_modules/.bin/tsc -p tsconfig.renderer.json --noEmit-> pass.Stack validation / dependency notes
This PR is a clean cherry-pick onto upstream
mainso it contains only the AI stream IPC batching change. Fullpnpm testand renderer typecheck on upstreammainare currently blocked by unrelated stack dependencies that are present on the integration branch but not included here:pnpm teststops before running tests withERR_PNPM_IGNORED_BUILDSbecause upstreammainlacks the native build-script approvals.