Performance

crust is a Bun backend plus the system WebView, and the compositor is the same one Tauri gets. So the question "why is my app slow" almost never has the answer "the WebView". It has one of three answers: work crust does on the main thread, work your page does, or latency the user feels rather than frames.

This page has the measured numbers for the first one, how to look at your own app with the overlay, and an honest account of what Tauri and native-Rust frameworks do differently.

Every number below was measured on one Apple-silicon machine under heavy, contaminating load: one-minute load averages ran 2.39–12.76 (05-pump.md:31), 3.74–6.17 (09-ab.md:16) and 3.12–6.97 (10-startup.md:25). Treat them as ratios, not absolute targets. Reports and commands are under docs/reviews/perf/.

What crust used to cost per frame

The macOS backend ran a repeating 16 ms timer that drained AppKit events. Every tick handed nextEventMatchingMask:untilDate:inMode:dequeue: a 4 ms deadline, which meant the JS thread waited inside AppKit on every single tick whether or not an event existed (05-pump.md:4-7).

metricbeforeafterpass (review)
mean time blocked per tick, idle6.841 ms2.796 mslane E, first pass (05-pump.md:44)
ticks delivered per second, idle41.1/s49.3/slane E, first pass (05-pump.md:46)
mean time blocked per tick, idle2.818 ms0.781 mslane E, second pass (05-pump.md:88)
ticks delivered per second, idle49.4/s54.4/slane E, second pass (05-pump.md:91)
ticks per second, window occluded~40/s~13/socclusion arm (05-pump.md:106)
animating page, frame p5022 ms17 mssame-tree A/B (09-ab.md:10,63)
animating page, frame p9524 ms18 mssame-tree A/B, clean rows (09-ab.md:10-11,64,68-69)
animating page, fps57.6557.15same-tree A/B control rows (09-ab.md:56-57,65)

Before and after in each row come from the same pass; the two tick pairs are successive fixes, not one change measured twice (05-pump.md:42-47,82-92). The frame rows are a same-tree A/B: one machine, one session, interleaved arms, two control rows (09-ab.md:22-36). Its p95 delta of 6 ms is outside a 0 ms same-arm control spread, while fps is inside it, so this is a frame-time win, not a throughput win (09-ab.md:59-70). The first A/B arm's 34 ms p95 was a load spike and is excluded from the clean row (09-ab.md:52,68-69).

The CPU version of the finding was killed, not improved: idle CPU was 1.7% before, stayed 1.7%/1.2% in the first pass (05-pump.md:11-12,47) and 0.7%/0.8% in both arms of the second (05-pump.md:92). No CPU row belongs in a table of wins.

Blocking 6.841 ms at 41.1 ticks/s is about 281 ms of every second spent waiting before your page gets a turn (05-pump.md:44,46) — that is the difference between an animation that looks smooth and one that visibly hitches. Passing nil as the deadline makes an empty queue return immediately, and a 0.25 ms run-loop slice keeps painting serviced (05-pump.md:63-68). A native menu still opens, a window still drags, and a capture through window.capture still paints (05-pump.md:119-121).

What crust does not cost

These were hypothesised as the cause and measured as noise. Each arm sat inside the spread of the same arm run against itself, which is the only honest bar for a small delta.

armresult
invokes at 30/s and at 200/sfree — no frame cost outside the control spread (07-page-invoke.md:3-4,50-51)
a 30 Hz server-sent event streamfree at 30 Hz and at 120 Hz (07-page-invoke.md:3-4,52-53)
webview configuration flagsdrawsBackground, wantsLayer, layerContentsRedrawPolicy, suppressesIncrementalRendering and a fresh process pool each changed nothing (03-renderer.md:108-109,119)
the invoke round trip5.8–6.7 µs end to end, and 0.045 ms on a reused socket (02-hotpaths.md:67-68; 04-parity.md:106)
a 1 MB binary result40 µs p50 / 100 µs p95 to parse in the page (07-page-invoke.md:91)

So if your app feels slow, it is not the bridge. Look at what your page does per frame, at how often you re-render, and at latency — a smooth app still feels broken when a keystroke visibly lags.

The overlay

The overlay is a page module, imported from its own subpath so a production build that never imports it cannot carry it:

import { mountOverlay } from "crust/perf/overlay";

const overlay = mountOverlay(); // dev-only module; never import it from the production entry

Mount the runtime half in main.ts and the two halves talk over the same commands a page can call directly:

import { createPerfPlugin } from "crust/plugin";

app.plugin(createPerfPlugin()); // until this runs, every perf call refuses with "perf plugin mounted"

There are two invoke arities: invoke(plugin, command, args) and invoke(name, args), the latter routing through the app namespace (src/bridge/client/install.ts:161-170). Reaching the perf plugin needs the first form:

await crust.invoke("perf", "overlay", { enabled: true });

It shows frames drawn, fps, frame-time p50/p95/worst, long tasks, runtime event-loop delay and the three busiest plugins by invoke count (src/perf/overlay/overlay.ts:89-102; audit §Overlay). Frame statistics come from the page's own requestAnimationFrame deltas; the runtime half reports event-loop delay, heap, invoke counts and event throughput (src/perf/overlay/overlay.ts:99-102).

Two behaviours worth knowing:

Reading the same numbers yourself, from a page:

const sample = await crust.invoke("perf", "sample");
// { at, frame, runtime, invoke, events, log } (src/perf/sample.ts:23-35)

frame is null only until a page reports one. "Nothing was drawn" is a non-null frame with framesDrawn === 0; an occluded window is reported by that zero, never by a fabricated 0 fps frame (src/perf/sample.ts:14,25; src/plugins/perf.ts:10-12).

Recording from the CLI

crust perf record --app <project-dir> --seconds 10 --out perf.json [--format json|text] resolves --app to a directory with index.html, a project directory with public/index.html, or a bundle with Contents/Resources/public/index.html; a path with none of those is refused with not an app: … — no index.html or public/index.html (src/cli/perf/app-root.ts:18-34, src/cli/perf/record.ts:62-63). --seconds is the sampling duration; a run whose renderer never painted is refused with exit 2 and no sample file (src/cli/perf/record.ts:119-125).

--format defaults to text, which prints one headline line shaped fps=<fps> p50=<ms>ms p95=<ms>ms long=<n> heap=<MB>MB; json prints the summary, meta and output path as one JSON line (src/cli/perf/index.ts:16,63-69,132-133; src/cli/perf/format.ts:27-33).

Why Tauri apps feel smooth

Tauri embeds the same WKWebView through wry, so page layout, script and paint are the same WebKit work. Two structural differences matter, and only one of them is a crust cost:

  1. Tauri's main thread runs a native event loop (tao's EventLoop::run), not a JavaScript timer doing AppKit work. That was crust's 16 ms pump above, and it is now fixed.
  2. Tauri's invoke is a custom-protocol fetch (ipc://localhost/<cmd> with the callback in a header), not a loopback HTTP POST. crust measured its own loopback path at 5.8–6.7 µs per invoke (02-hotpaths.md:67-68), so this is a microsecond difference, not the reason an app feels different.

Claiming the IPC design is why Tauri feels fast would be a story, not a measurement. The event loop was the real difference.

Why Rune feels smooth, and what cannot be copied

Rune is a native GPU-rendered framework: a Rust element tree, a display-link-paced render thread, and no JavaScript bridge in the desktop path. That buys smoothness crust cannot reach while its UI is a system WebView — there is no DOM, no style recalculation, no layout pass, and no compositor handoff between your code and the drawable.

Two honest caveats. Rune evaluated GPUI and rejected it, so "GPUI's scene graph" is not the explanation for Rune's smoothness. And Rune still hands off to the window server for glass, video and native layers, on the main thread.

The parts of the gap that are closable, and are now closed: main-thread blocking from the event pump, and having no way to see where your own frames go. The parts that are not closable without replacing the WebView: owning the paint loop and skipping the compositor.

Startup

Launch to interactive is a different problem from frame rate, and the measurement says crust is not where the time goes:

segmentms
everything before the window128 (10-startup.md:72)
NSWindow + WKWebView creation318 (10-startup.md:42)
first navigation192 (10-startup.md:43)
total608 (harness-corrected: 10-startup.md:58)

A bare AppKit program — one NSWindow, a stock WKWebView, loadHTMLString, no crust in the process — takes 568 ms p50 to its first requestAnimationFrame (10-startup.md:110). Adding crust's window configuration, its content world and injected scripts, its scheme handler, its process pool and its bridge one at a time moved that by no more than the 21 ms control spread, except the injected scripts which were inside it after one contaminated run was excluded (10-startup-bare.md:57-58).

Like for like, crust adds about 72 ms end to end: the harness-corrected 608 ms launch minus the 536 ms corrected bare floor (10-startup.md:4-6,58). The rest is WebKit bringing up its services and producing the first frame. Two consequences worth knowing:

What this means for your app: if launch feels slow, the time is WebKit starting and your first paint, not crust's initialisation. Keep the first paint simple — a small document that paints something immediately and loads the rest afterwards beats a large document that paints once.

Measuring your own app

Start with the overlay and answer three questions in order:

  1. What is the frame time with nothing happening? If an idle page hitches, something in your page is re-rendering continuously.
  2. Does frame time rise when you interact? If yes, look at what the interaction handler writes to the DOM, not at the bridge.
  3. Is it latency rather than frames? A click that visibly lags before showing a result is a blocked main thread or a slow handler, and a profiler that only reports fps will tell you everything is fine.