Repository navigation
perf(renderer): halve startup JavaScript and replace idle git polling #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
8af69ab
perf(renderer): keep the dictation pill off the ipc.ts parser graph (…
sambitcreate 6488157
perf(renderer): lazy-load highlight.js grammars and drop auto-detecti…
sambitcreate eeec4f4
perf(renderer): load KaTeX only for messages that contain math (UI-3)
sambitcreate e60eedb
perf(renderer): split non-chat routes and rare panels out of the entr…
sambitcreate 12f486d
perf(renderer): issue startup reads before the app chunk evaluates (U…
sambitcreate 0d2bcdd
perf(renderer): give the query client deliberate defaults (UI-16)
sambitcreate 856ae66
perf(git): memoize the git executable per PATH (MAIN-22)
sambitcreate 3a0fcbb
perf(git): push repository changes from a .git metadata watcher (MAIN…
sambitcreate 877fc2c
perf(renderer): refresh Git panels from events and poll only as a saf…
sambitcreate ac143f4
perf(renderer): poll Remote status only while it is on screen (UI-19,…
sambitcreate 5ab2fed
perf(renderer): derive the model picker lists only while it is open (…
sambitcreate 57ad10c
docs(memory): record the renderer bundle and polling work
sambitcreate 353ad2d
Merge remote-tracking branch 'origin/main' into perf/renderer-bundle-…
sambitcreate a665fb2
fix(e2e): stub the startup catalog refresh with the palette's providers
sambitcreate 3b98c5f
Merge origin/main into perf/renderer-bundle-polling
sambitcreate e156c2c
Merge origin/main into perf/renderer-bundle-polling
sambitcreate c12d45b
Merge origin/main into perf/renderer-bundle-polling
sambitcreate File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Renderer bundle and display polling — 2026-10-03 | ||
|
|
||
| Branch `perf/renderer-bundle-polling`. Audit IDs UI-1–5, UI-14–19, MAIN-22/23 (from the 2026-10 whole-app audit). No persisted-format or Remote protocol change; `git:changed` is desktop-only and never forwarded to iOS/Android. | ||
|
|
||
| ## Bundle (main-window startup closure, vite build) | ||
| - Baseline 3,328 KB JS (1,019 KB gzip) → 1,640 KB (509 KB gzip); dictation pill 475 → 234 KB. | ||
| - UI-1 `renderer/lib/syntax-highlight.ts`: hljs core plus per-language dynamic imports; aliases map to grammar modules. `highlightAuto` was dropped, so unlabeled fences render plain (owner decision). | ||
| - UI-3 `renderer/lib/markdown-math.ts`: remark-math/rehype-katex and the KaTeX CSS load only when a message contains math delimiters. | ||
| - UI-2 `router.tsx` `lazyRouteComponent` for non-chat routes; BrowserPanel and DevicesPanel are lazy. | ||
| - UI-4 `renderer/lib/ipc-bridge.ts` / `ipc-voice.ts`: the pill no longer pulls the `ipc.ts` parser graph. | ||
| - UI-5 `renderer/main/index.tsx` is a thin entry that issues startup reads, then imports `./app` (`startApp(startup)`). Source-grep startup tests now target `app.tsx`. | ||
|
|
||
| ## Queries and polling | ||
| - UI-16 `createAppQueryClient` (`renderer/lib/query-client.ts`): staleTime 30 s, refetchOnWindowFocus off, retry 1; live surfaces opt back in. | ||
| - MAIN-22 `resolveGitExecutableMemoized` (`main/services/git-executable.ts`): keyed on binary/PATH/DEVELOPER_DIR, revalidated, 5 min TTL, failures uncached. Removes one `xcode-select` per Git command under a GUI PATH. | ||
| - MAIN-22 `main/services/git-repo-watcher.ts`: `fs.watch` on gitDir admin files, commonDir packed-refs and recursive refs (fallback refs/heads); debounced 250 ms, monotonic generation, evicted after 10 min unread. Started by `workspaces:gitInfo`, `git:review`, `git:pushCapability`; broadcasts `git:changed {workspaceId, generation}`. | ||
| - UI-17 `renderer/lib/git-query-sync.ts` (mounted in `root-view.tsx`): `git:changed` invalidates repository reads, `chats:settled` and throttled (5 s trailing) tool results invalidate working-tree reads, window activation restarts intervals and refetches stale reads. Git panels poll at 60 s only while the window is visible and focused (`gitSafetyPoll`). | ||
| - UI-18 PR status polls every 5 min; a repository change refreshes it only once it is ≥1 min old. | ||
| - UI-19/MAIN-23 `aidenRemoteSettingsQueryOptions(live)`: the always-mounted badge polls at 60 s while active, none while inactive; the open popover and Remote settings keep 10 s. No main-side Tailscale cache (deferred). | ||
| - UI-15 ModelPicker memoizes catalog entries on per-provider data references and derives list order/detail positions only while open. `useProvidersModelInfo` itself is untouched (owned by the MCP/network workstream). | ||
|
|
||
| ## Deferred / skipped | ||
| - Repository discovery cache: kept at the 1 s TTL for the reasons in `git-display-read-performance.md`; the watcher removes the need for faster polling instead. | ||
| - UI-14 header `backdrop-filter`: kept. Without blur, 6% of sharp transcript text ghosts through the 94% surface; an opaque fill would stop matching the translucent window. | ||
|
|
||
| ## Measurements | ||
| Git spawn counts per read (GUI PATH): info 12 → 6, review 28 → 14, pushCapability 46 → 23. Idle minute with the environment panel open: ~1,116 processes → ~43 focused, 0 blurred. |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] Invalidate the main Git caches before notifying the renderer
An external checkout shortly after a display read triggers this notification while
GitService's one-second info/branch caches are still valid, so the renderer's immediate refetch can install the old branch as fresh data. A real repository reproduction returnedmaininstead of the newly checked-outtopicat 260 ms; with the new minute safety poll, the branch display can remain wrong long after that cache expires.Technical details