#54515: perf: prefetch the framework on cold launches on macOS
Merged
Created: Sep 28, 2026, 11:32:21 AM
Merged: Sep 28, 2026, 4:48:36 PM
2 comments
Target: main
Description of Change
On a cold launch (after a reboot, an app update, or once the app has been evicted from the page cache), macOS pages the ~200 MB framework in with thousands of small reads that stall the main thread and every child process. This reads those files sequentially on a background thread as the browser process starts, so the faults hit the page cache instead.
shell/app/electron_prefetch_mac.mm: reads the framework binary,libffmpeg.dyliband the framework's.pak/.dat/.binresources on a background thread at the top ofElectronMain(browser process only).- Skipped on warm launches (framework
__TEXTalready resident permincore) and when memory pressure isn't normal or less than 512 MB is available. - Universal builds read only the running architecture's slice and skip the other architecture's V8 snapshot.
- Runs at
IOPOL_UTILITYso it yields to the main thread's own reads.
Spawn → first contentful paint of a localhost page, Apple silicon, internal SSD, release build, paired runs. Cold = app bundle evicted from the page cache before each launch.
| before | after | Δ | |
|---|---|---|---|
| Cold (n=30) | 455 ms | 317 ms | −141 ms (−31%) |
| Cold, disk busy with other reads (n=20) | 649 ms | 334 ms | −315 ms (−49%) |
| Warm (n=30) | 281 ms | 286 ms | no measurable change |
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
-
npm testpasses
Release Notes
Notes: Improved cold-launch time on macOS by prefetching Electron's framework files.
Backports
Semver Impact
Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron