Skip to content

perf(desktop): reuse fonts and device models in macOS updates - #4027

Open
renningg wants to merge 1 commit into
goat-si:devfrom
renningg:perf/mac-update-zip
Open

renningg wants to merge 1 commit into
goat-si:devfrom
renningg:perf/mac-update-zip

Conversation

@renningg

Copy link
Copy Markdown
Contributor

A change to a JS bundle can make a Mac updater download unchanged document fonts and device models again: the ZIP compresses the whole app.asar as one entry.

Use electron-builder’s existing asarUnpack filter for the generated web fonts and GLB models on macOS. Each asset then gets its own compressed ZIP entry and keeps its existing Electron path. JS and WASM stay archived. This requires no updater change and benefits users once both releases use the layout. Electron ASAR file resolution.

Release replay

ZIP payload MB (decimal) with a cached previous ZIP. “First switch” uses the official older ZIP and the proposed newer layout.

macOS Upgrade Official Both use this change First switch
arm64 0.1.13 → 0.1.14 122.88 76.76 123.31
arm64 0.1.14 → 0.1.15 101.93 59.14 102.49
arm64 0.1.15 → 0.1.16 120.28 75.33 120.92
x64 0.1.13 → 0.1.14 118.50 70.23 118.96
x64 0.1.14 → 0.1.15 96.16 53.39 96.70
x64 0.1.15 → 0.1.16 116.01 73.30 116.62

For each architecture and release, the experiment used the published ZIP, retained the ASAR file order, moved the matching bytes into unpacked entries, refreshed the ASAR header hash, applied an ad-hoc signature, and updated the ZIP with 7-Zip. Ran electron-updater’s download planner on each pair of blockmaps and verified that its COPY and DOWNLOAD operations reconstruct the exact target ZIP by SHA-256. These are release replays. Production Developer ID signing and notarization run in release CI.

For arm64 0.1.15 → 0.1.16 also ran the actual 0.1.15 MacUpdater against an isolated range server. The stock layout transferred 120,276,036 ZIP bytes in 63 HTTP 206 responses. The new layout transferred 75,327,375 bytes in 115 responses. The first switch transferred 120,922,951 bytes. The downloader verified the target ZIP. Blockmaps and HTTP headers are excluded from the table. The full arm64 0.1.16 ZIP grew by 41,892 bytes in this replay.

The higher range count can matter on high-latency links. With a local single-range server injecting a 40 ms delay per request and pacing each response body toward 50 Mbit/s, two runs of the same old MacUpdater took 23.18 / 23.26 seconds on stock and 19.44 / 19.29 seconds with the new layout (download and reconstruction only). Public CDN and geography will affect elapsed time.

Verification

  • Built a small macOS app with the project’s electron-builder, launched it in Electron, and verified all five asset extensions at their existing paths. JS and WASM remained packed.
  • Read all 107 unpacked assets (64,788,480 bytes) through the original ASAR paths in the repacked arm64 app and the Intel app under Rosetta; checked SHA-256 against their physical files.
  • Verified the ad-hoc macOS bundle signature. No installation into Applications or production update channel was used.
  • vp test run scripts/build-desktop-artifact.test.ts (97 passed) and vp run check:changed (150 tests, typecheck, lint and remaining gates passed).

Model: GPT-6. Harness: Codex.

This branch has not been deployed

No deployments
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