BakeNative is under active development. APIs may change.
Skip to Content
BakeNative

Embedding cost

What one BakeNative screen adds to an existing iOS or macOS app: time to the first frame, time to interactive, binary size and memory, next to the same screen written in UIKit, AppKit and SwiftUI.

BakeNative is meant to go into an app that already exists, as one screen. This page measures what that screen costs the host app. The screen is the Starter app (examples/app): an app bar with a five-way switcher, a counter button, a logo, a title, a paragraph and four cards. For comparison, the same screen is also written natively in UIKit, AppKit and SwiftUI (examples/ios-brownfield/App/NativeStarter.swift, examples/mac-brownfield/Sources/ShellKit/Starter.swift). The native versions show the logo as an SF Symbol, because a native app ships its logo as an image rather than SVG path data.

The hosts:

  • iOS: examples/ios-brownfield, a UIKit app with a UINavigationController. The BakeNative screen is an BakeNativeViewController pushed with the normal animated push, from the catalog's row selection.
  • macOS: examples/mac-brownfield, an AppKit app with one 640×480 window. Opening a screen swaps its view controller in as the window's content, which is the AppKit equivalent of a push. The BakeNative screen is an BakeNativeView. MacShell is the same app without BakeNative.

The iOS numbers below come from the simulator on a Mac, not from a phone. Simulator timings depend on the Mac and are not what users see. The device row is still to be measured.

What is measured

  • First frame: from the open to the display refresh that shows the screen's content. On iOS the open is the row selection. On macOS it is the moment before the screen's view controller is created. The end is the first display refresh after the Core Animation commit that carries the content. It is computed from the display link's phase and period, so a callback delivered late does not move it.
    • iOS: that commit is the push transaction's commit when the content is in it, which is the case for native screens and for a BakeNative screen drawn from a frame. For a first mount from JavaScript it is the first commit that has the BakeNative views.
    • macOS: it is the end of the first main run loop turn after which the screen's whole view tree is laid out, displayed and layer-backed. AppKit displays a new view in its own display cycle, after Core Animation's commit observer.
  • Interactive: for BakeNative, the screen is adopted (snapshot views kept, JavaScript handlers attached) or mounted. Native screens take input from their first frame, so for them interactive equals first frame.
  • Views created on adopt: how many native views the adoption had to create. It should be 0: the first frame's views are kept as they are.
  • Binary size: the same minimal app built twice, without and with BakeNative plus one screen. On iOS that is SizeShell and SizeShellBakeNative; on macOS, MacShell and MacBrownfield. Release builds. The executable is measured after strip -S -x, the way an archive ships it.
  • Memory: phys_footprint (what jetsam and Activity Monitor count). One process per screen type, 10 open/close cycles, measured before the first open, while the screen is shown, and 2 s after each close.

Every timing is the median and p90 of at least 30 samples. A sample counts only while the Mac is quiet. The default rule is a 15-minute load average below 40. These results used a quiet-window rule instead: the 1-minute load below 30 for two minutes before measuring, and below 30 at every sample.

  • Cold samples are the first open after launching a fresh process, one sample per process.
  • Repeat samples come from one process that opens and closes the screens over and over, interleaved, after warm-up opens.

On iOS, the cold BakeNative open is measured twice: once with the frame cache emptied (the first mount, from JavaScript), once with it kept (the frame from the device cache). The cold UIKit and SwiftUI screens are measured the same way. The repeat runs measure BakeNative with and without a prewarm.

Results

iOS simulator: first push after launch (a fresh process per sample)

Simulator iPhone19,4, 2026-11-26; load at the samples: 1-minute 4.8–19.2, 15-minute 15.4–24.3; 0 samples dropped (1-minute load >= 30).

ScreenNFirst frame (median / p90 ms)Interactive (median / p90 ms)Views created on adopt
BakeNative Starter: adopted, prewarm off30100.8 / 127.6100.0 / 127.10 (max of 30)
BakeNative Starter: mounted, prewarm off30104.4 / 120.0104.3 / 124.6–
SwiftUI Starter30139.7 / 172.7139.7 / 172.7–
UIKit Starter30113.3 / 138.2113.3 / 138.2–

iOS simulator: repeat push in one process (frame cache hit)

Simulator iPhone19,4, 2026-11-26; load at the samples: 1-minute 8.8–19.7, 15-minute 64.4–81.6; 0 samples dropped (1-minute load >= 30).

ScreenNFirst frame (median / p90 ms)Interactive (median / p90 ms)Views created on adopt
BakeNative Starter: adopted, prewarm off3032.7 / 45.932.3 / 44.50 (max of 30)
BakeNative Starter: adopted, prewarm on (hit)3035.3 / 44.033.4 / 42.80 (max of 30)
SwiftUI Starter3037.3 / 53.337.3 / 53.3–
UIKit blank screen (floor)3031.1 / 36.231.1 / 36.2–
UIKit Starter3042.8 / 50.742.8 / 50.7–

macOS: first open after launch (a fresh process per sample)

arm64, Version 27.0.1 (Build 26A434), 100 Hz; 2026-11-26; load at the samples: 1-minute 10.2–17.0, 15-minute 26.0–33.6; 0 samples dropped (1-minute load >= 30); 0 occluded or timed out.

ScreenNFirst frame (median / p90 ms)Interactive (median / p90 ms)Views created on adopt
AppKit Starter3037.8 / 47.437.7 / 47.2–
BakeNative Starter: adopted, prewarm off3035.4 / 39.235.5 / 38.90 (max of 30)
BakeNative Starter: adopted, prewarm on (hit)3028.9 / 36.225.5 / 31.10 (max of 30)
SwiftUI Starter3060.2 / 65.160.2 / 65.0–

macOS: repeat open in one process

arm64, Version 27.0.1 (Build 26A434), 100 Hz; 2026-11-26; load at the samples: 1-minute 12.7–17.8, 15-minute 44.0–53.9; 0 samples dropped (1-minute load >= 30); 0 occluded or timed out.

ScreenNFirst frame (median / p90 ms)Interactive (median / p90 ms)Views created on adopt
AppKit Starter3029.6 / 31.929.6 / 31.9–
BakeNative Starter: adopted, prewarm off3020.0 / 22.716.5 / 20.10 (max of 30)
BakeNative Starter: adopted, prewarm on (hit)3016.4 / 23.016.5 / 18.30 (max of 30)
SwiftUI Starter3026.2 / 38.626.2 / 38.6–

Adopted samples in the timing tables: 210, views created on adopt: max 0.

iOS simulator: memory (phys_footprint, MB)

ScreenProcesses × cyclesIdleBefore first openShown (median; vs idle)After close, cycle 1After close, last cycle (vs idle)
UIKit Starter1 × 1025.325.332.0 (+6.8)29.432.7 (+7.5)
SwiftUI Starter1 × 1025.825.631.8 (+6.1)30.631.7 (+5.9)
BakeNative Starter, prewarm off1 × 1025.525.536.3 (+10.8)29.034.0 (+8.5)
BakeNative Starter, prewarm on1 × 1026.527.337.1 (+10.7)33.634.4 (+8.0)

macOS: memory (phys_footprint, MB)

ScreenProcesses × cyclesIdleBefore first openShown (median; vs idle)After close, cycle 1After close, last cycle (vs idle)
AppKit Starter (MacShell)1 × 1017.517.520.3 (+2.9)20.619.9 (+2.4)
SwiftUI Starter (MacShell)1 × 1016.716.724.5 (+7.8)23.923.9 (+7.2)
BakeNative Starter, prewarm off (MacBrownfield)1 × 1017.117.124.6 (+7.5)22.322.7 (+5.6)
BakeNative Starter, prewarm on (MacBrownfield)1 × 1017.319.825.1 (+7.8)22.522.4 (+5.2)

iOS: binary size (Release, unsigned)

Device (arm64)Simulator (arm64)
Executable, stripped (strip -S -x)0.14 → 3.65 MB (+3.52)0.12 → 3.65 MB (+3.53)
hermesvm.framework (embedded, as shipped)+3.62 MB+3.62 MB
One Octane screen (app.hbc + app.css + manifest)+0.34 MB+0.34 MB
.app, executable stripped0.14 → 7.61 MB (+7.48)0.12 → 7.61 MB (+7.48)
.app as zip -9 (≈ compressed download)0.05 → 3.32 MB (+3.27)0.05 → 3.39 MB (+3.34)

macOS: binary size (release, arm64)

MacShell → MacBrownfield
Executable, stripped (strip -S -x)0.19 → 3.75 MB (+3.56)
hermesvm.framework (embedded)+4.33 MB
Resources (one Octane screen with its baked app.baked)+0.39 MB
.app, executable stripped0.19 → 8.47 MB (+8.28)
.app as zip -90.09 → 3.65 MB (+3.56)

Reading the results

  • Adoption created no views. Every adopted sample in the timing tables reported viewsCreatedOnAdopt = 0 (the count line above the memory tables).

  • iOS, first push after launch. Two cases ran:

    • mounted: the frame cache was emptied, so the screen mounts from JavaScript;
    • adopted: a fresh process with the frame cache on disk.

    On the simulator, both BakeNative cases and the UIKit and SwiftUI screens fall between about 100 and 140 ms. The native screens pay the same first-push cost.

  • iOS, repeat push. The cached BakeNative screen opens within about 2 ms of the blank UIKit screen, which is the floor of a push. With a prewarm that hits, it was no faster on the simulator (35.3 vs 32.7 ms median).

  • The iOS native rows rest on an assumption. The UIKit and SwiftUI rows assume the content is in the push transaction's commit. Verifying that is the first gap. The macOS rows check it.

  • iOS prewarm in a fresh process. For the first push after launch, BakeNativeBundle.prewarm prepared nothing in this run. No viewport had been learned yet, so the prewarm estimated 382×600 under a standard navigation bar, but the screen opened at 382×562 under the catalog's large title (ios-sim-memory.json, the first cycle of the prewarm-on process: prewarmStage nil, prewarmEstimate, viewEnvironment). The estimate missed the frame cache slot, and this bundle ships no app.baked. From the second push on, the learned size matched and the prewarm hit. The prewarm now takes the size from the slot an earlier launch cached, or from the navigation bar as it is, so the first push of a new process hits too. These tables predate that change.

  • Memory does not return to the level before the first push. It plateaus.

    • iOS (simulator): after the last close, BakeNative sits +8.5 MB above idle, against +7.5 MB for UIKit and +5.9 MB for SwiftUI.
    • macOS: after the last close, BakeNative sits +5.6 MB above idle, against +2.4 MB for AppKit and +7.2 MB for SwiftUI.
    • Over 10 cycles: the after-close value is flat on macOS. On iOS, UIKit and BakeNative each step up once at the 5th cycle (+2.3 and +4.7 MB), in separate processes, then stay flat. The cause of that step was not identified and may come from the harness. Only one process per row was measured.
    • Prewarm rows: their "before first open" value includes the prepared screen, so compare against idle.
    • Linking BakeNative (macOS): it does not change idle memory. The idle footprint is about the same in MacShell and MacBrownfield (16.7–17.5 MB). On iOS this was not measured: every iOS row runs in the one app that links BakeNative.
  • Load. These ran in a quiet window: every sample was taken with the 1-minute load below 30. The 15-minute average was still coming down from an earlier busy period: 44–82 during the repeat runs and 15–34 during the cold runs.

Gaps

  • On iOS, whether the native screens' content is in the push commit is not verified. The macOS layer check was not ported to iOS.
  • iOS cold opens were not run with a prewarm (when these ran, the first prewarm of a process prepared nothing, see above), and the cold blank-screen floor was not run either.
  • Memory was measured with one process per row instead of three.
  • iOS idle footprint without BakeNative linked was not measured.
  • The device row below is empty.

Device

First frameInteractiveMemory
iPhone (device)to be measuredto be measuredto be measured

Reproduce

tools/build-rust-apple.sh && examples/ios-brownfield/build-octane.sh

# Sizes (no simulator needed)
tools/embed-cost/ios-size.sh
examples/mac-brownfield/build.sh && examples/mac-brownfield/package-app.sh
node tools/embed-cost/mac-size.mjs

# macOS timings and memory
# (--load-1m 30 --sustain 120: the quiet-window rule used here; default: 15-minute load < 40)
node tools/embed-cost/mac-trace.mjs cold --load-1m 30
node tools/embed-cost/mac-trace.mjs warm --load-1m 30
node tools/embed-cost/mac-trace.mjs memory --reps 1 --load-1m 30

# iOS simulator: Release build with the trace's Core Animation phases, then each mode
xcodebuild -project examples/ios-brownfield/iOSBrownfield.xcodeproj -scheme iOSBrownfield \
  -configuration Release -destination 'generic/platform=iOS Simulator' \
  -derivedDataPath examples/ios-brownfield/build/trace \
  "SWIFT_ACTIVE_COMPILATION_CONDITIONS=\$(inherited) BAKE_OPEN_TRACE" build
node tools/embed-cost/ios-trace.mjs cold --udid <UDID> --cells 0,2,4,5 --load-1m 30
node tools/embed-cost/ios-trace.mjs warm --udid <UDID> --load-1m 30
node tools/embed-cost/ios-trace.mjs memory --udid <UDID> --reps 1 --load-1m 30

node tools/embed-cost/report.mjs   # the tables above (each file's own load rule)

The raw results are in docs/data/embedding-cost/. Every sample there includes the load average, the launch phase, the prewarm outcome and the open's timeline.

On this page