Skip to content
CefSwift
Esc
↑↓navigate↵open⌘Jpreview
On this page

Measured and not used

Memory switches, locale packs, SwiftShader and component updates: what was measured and left out, and why.

Scripts/measure-footprint.py Examples/dist/Minimal.app -- --js-flags=--lite-mode

Measurements behind choices CefSwift has made, and mechanisms it measured and does not use. The guide describes what CefSwift does; this page records why. Figures come from the machine and method described in the guide’s Footprint and launch time section unless a note says otherwise: an Apple M3 MacBook with 16 GB of memory, macOS 27.2.1, CEF 156.0.28, 2026-11-12.

Memory settings measured and not used

These were measured on the Minimal example and are not used: they saved nothing on an idle page, cost more than they saved, or save the same as processPolicy = .onDemand.

  • --js-flags=--lite-mode and --js-flags=--optimize-for-size: no difference while idle; both slow JavaScript down.
  • --disable-extensions, --disable-spell-checking, and turning off optimization-guide model downloads, Safe Browsing real-time lookups, certificate-transparency updates and preloading: no difference.
  • --disable-gpu-compositing: 10 MB more.
  • --renderer-process-limit=1 and --disable-site-isolation-trials: save the spare renderer, as .onDemand does; the second also gives up site isolation.
  • --enable-low-end-device-mode: saves the spare renderer and 3 MB more in the GPU process, and lowers rendering quality.

Locale packs, SwiftShader and component updates

Measured on 2026-11-13 with CEF 156.0.28 arm64 on an M3, macOS 27.2.

Bundle size. The Minimal example (English only), logical size of regular files: 333.0 MiB with every locale pack, 284.0 MiB with en only (54 packs, 48.9 MiB, left out), 268.0 MiB without SwiftShader as well (16.1 MiB). du reports 334 MiB, 284 MiB and 268 MiB.

A locale without a pack. Chromium told --lang=ja with no ja.lproj in the framework starts, reports the locale it was told, and shows English strings: NSBundle falls back to another localization of the framework. CefKit therefore resolves the locale against the packs before cef_initialize, so the locale Chromium reports matches its strings.

SwiftShader. Pages render, windowed and offscreen, with and without it and with --disable-gpu. WebGL runs on ANGLE’s Metal backend with the GPU; with --disable-gpu there is no WebGL unless --enable-unsafe-swiftshader is passed and SwiftShader is in the bundle. Chromium 156 does not fall back to SwiftShader by itself.

Component updates off. With --disable-component-update Chromium registers none of the components of RegisterComponentsForUpdate (Widevine, CRLSet, PKI metadata, Safe Browsing lists, origin trials, …), but it still registers the on-device model manifest (“Optimization Guide On DeviceModels Manifest”) and starts downloading it: the optimization guide registers it outside that function. Turning off the OptimizationHints or OptimizationGuideModelExecution features does not stop it; no switch that does was found.

Widevine with component updates on and protected media off. CefSwift does not ask for the CDM, and Chromium’s updater still tries to fetch it: in a run with protectedMedia = .disabled, componentUpdates = .automatic and an unreachable DNS-over-HTTPS server, the Widevine component, which started as not installed, reported an update error within 170 seconds, having been checked without any request from CefSwift.

The framework as a binary target

Measured and not used. Pull request #27, ported as the first version of #41, made CEF a SwiftPM binary target: both architectures’ minimal distributions merged into one XCFramework zip (lipo -create of each Mach-O file, everything else unchanged), hosted as a GitHub release asset and pinned by checksum, so SwiftPM and Xcode would fetch it while resolving the package. Measured with CEF 158.0.6 on an M3:

CEF’s distributions (kept) XCFramework binary target (not used)
Download for an arm64 build 141 MB 278 MB (both architectures, always)
Download for an x86_64 build 149 MB 278 MB
Download for a universal build 290 MB 278 MB
An arm64-only zip, same packaging – 154 MB
Hosting CEF’s CDN A release asset per CEF version, never deleted once a tag pins it
Minimal.app, arm64 306,148 KiB 306,136 KiB, the same files

What decided it:

  • A binary target cannot be conditioned on architecture. Its conditions are platforms, so a package cannot fetch only the slices a build targets; and SwiftPM fetches every remote binary target of every package in the graph when it resolves it, whether or not a product being built uses it (a fixture whose unused binary target named a missing asset failed swift build of an unrelated product with badResponseStatusCode(404)). Every dependent, a library-only one included, would download 278 MB, about twice what a one-architecture build needs.
  • CEF’s own archives are as small, and already pinned. The arm64 distribution, .tar.bz2, is 141 MB against 154 MB for the arm64 framework alone as a zip, and CEF_VERSION.json already pins each archive’s size and SHA-1, so per-architecture fetches need no hosting and no one-way release asset.
  • What the binary target did offer, Xcode embedding the framework itself and a cache shared by every project, is not needed by the Xcode phase, which embeds and signs the framework either way.

So both tracks fetch CEF’s distribution for each architecture they build for, and merge the two for a universal build (Architectures). The merge is the same one the XCFramework packaging did, with the same checks. Measured on the same Mac:

cef bundle --product Minimal Downloads Time App
arm64, empty cache arm64 (141 MB) 198 s 306,136 KiB, arm64
--architectures universal after it x86_64 only (149 MB), then a 3.2 s merge 497 s, most of it compiling for x86_64 592,916 KiB, both
--architectures x86_64 after it Nothing 150 s 322,212 KiB, x86_64
arm64 again Nothing 32 s 306,136 KiB

The Xcode phase, driven with an Xcode build’s environment and an empty cache: a Debug build (ONLY_ACTIVE_ARCH, ARCHS for both) fetched arm64 alone and took 365 s, most of it building cefswift and the helper; an archive for both then fetched only x86_64, merged, and made a universal helper and framework in 177 s. The universal app runs natively, and under Rosetta (arch -x86_64) with its browser process in x86_64 and some helpers natively; the x86_64 app runs entirely under Rosetta. Each loaded its page and quit cleanly. Timings were taken with other builds running.

Was this page helpful?