Skip to content

perf(memory): reuse IPC RpcDispatcher, flush Blink cache on hide, and lazy-load win32 WSL IPC - #47655

Closed
nwparker wants to merge 1 commit into
perf/mem-13-flush-blink-startup-cache-and-trim-rendererfrom
perf/mem-14-reuse-ipc-dispatcher-and-hide-cache-trim
Closed

nwparker wants to merge 1 commit into
perf/mem-13-flush-blink-startup-cache-and-trim-rendererfrom
perf/mem-14-reuse-ipc-dispatcher-and-hide-cache-trim

Conversation

@nwparker

@nwparker nwparker commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Reuse a single RpcDispatcher in src/main/ipc/runtime.ts across runtime:call and runtime:subscribe IPC invocations instead of allocating a fresh RpcDispatcher, method registry Map, LazyRpcMethodResolver, and OrchestrationLegacyCompatibility on every IPC call while working.
  • Flush Blink's decoded memory cache on window hide (document.visibilityState === 'hidden', debounced to 15s) in src/preload/index.ts so long working sessions reclaim dead decoded buffers when backgrounded.
  • Lazy-load Windows-only WSL IPC handlers (registerWslMoveWiring, registerWslDriveProjectHandlers) behind if (process.platform === 'win32') + dynamic import() in register-core-handlers.ts, pruning config/main-blocking-helper-baseline.txt (17 -> 16).

Verification

  • pnpm run build:electron-vite (including Sandbox preload verified: index.js; imports=electron)
  • pnpm check:changed --base=perf/mem-13-flush-blink-startup-cache-and-trim-renderer: 36/36 passed
  • Verified post-work steady-state memory returns cleanly to 438.9 MiB with zero leak (working-bench.mjs)

@brennanb2025

Copy link
Copy Markdown
Contributor

Superseded by #47917 (dispatcher reuse only: main CPU per call -15%). The clear-on-hide and win32-only WSL import parts were dropped: one re-decodes images, the other adds a rejected import retry on every macOS and Linux launch. Measured main vs head on win-high with a 1,921-worktree / 1,800-chat profile and a small profile. Thanks for the stack!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants