Skip to content

perf(desktop): keep the main process free for input - #8

Merged
nixuuu merged 1 commit into
devfrom
perf/desktop-first-interaction
Nov 3, 2026
Merged

nixuuu merged 1 commit into
devfrom
perf/desktop-first-interaction

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 3, 2026

Copy link
Copy Markdown
Member

On the desktop app the main process — on macOS the same thread that delivers input — was doing redundant work:

  • The controller re-published an identical status every second (24 events / 20 s at idle, 0 changes); each one rebuilt the application menu and the tray menu and sent IPC to every window. Status is now published only when it changes (→ 0 / 20 s).
  • webRequest.onBeforeRequest/onHeadersReceived had no filter, so every script, fetch and font round-tripped through the main process (176 callbacks per page load; renderer fetch p50 2.7 → 0.7 ms after the fix). The hooks are limited to mainFrame; the CSP and hash refresh still apply to every document.

Measured with a Playwright/Electron harness mirroring main.ts on Linux: dropdowns, menus and the command palette open in 26–32 ms on first and second use, with no lazy chunk requests, and the sidecar's immutable cache headers are correct — code-splitting and caching are not the cause. A simulated 60 ms main-process stall per second raised p99 open latency from 38.6 to 52.9 ms.

Checks: bun install, gen:check, typecheck, check:tmp (659 pass, 0 fail), web build. Needs a check on Apple Silicon: open menus right after launch and compare with the previous nightly.

Report desktop status only when it changes (24 identical events per 20 s each rebuilt the app and tray menus) and limit webRequest hooks to documents.
@nixuuu
nixuuu merged commit c6d5564 into dev Nov 3, 2026
2 checks passed
@nixuuu
nixuuu deleted the perf/desktop-first-interaction branch November 3, 2026 13:44
nixuuu added a commit that referenced this pull request Nov 3, 2026
One Canopy install replaces the separate Stable/Beta/Nightly products.
**Settings → App updates** (desktop only) stores the update channel
locally, shows the version and download progress, checks for releases
and restarts into an update. Moving to a more stable channel asks for
native confirmation of a one-off downgrade, with the data-compatibility
risk spelled out (`allowDowngrade` only for that attempt).

| Channel | Gets | Feed |
|---|---|---|
| Stable | stable | `latest` |
| Beta | stable, beta | `beta` |
| Nightly | stable, beta, nightly | `nightly` |

Feeds are cumulative and the highest semver wins; a stable release
publishes the `latest`/`beta`/`nightly` aliases, a beta
`beta`/`nightly`. Each release ships one Canopy artifact set, macOS
ZIP/blockmaps, manifest and checksums. The installed build's icon tint
stays.

Existing Canopy Beta/Nightly installs (e.g. 0.2.0-nightly.2) need a
one-time manual install of Canopy (Squirrel can't change the bundle
identity); their data stays untouched, no automatic import. The desktop
channel is independent of the gateway/worker update channel.

Checks: bun install, typecheck, gen:check, actionlint, production
web/desktop builds; AppImage and deb for all three channels (identity,
names, SHA-512, feed aliases, manifests); six update tests with real
electron-updater against a local feed server; `check:tmp` 662 pass / 0
fail. Rebased on dev (#5–#8): typecheck, web and desktop builds, release
script tests and actionlint pass again.

To confirm on a Mac: signing/notarization/Gatekeeper, Squirrel install
of the ZIP, channel switches with Cancel/downgrade consent, data
preserved.
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.

1 participant