Skip to content

Release binary: size weighed against speed, the fast profile kept - #1450

Merged
vmillet-dev merged 1 commit into
dev/1.0.0from
claude/trim-release
Nov 9, 2026
Merged

vmillet-dev merged 1 commit into
dev/1.0.0from
claude/trim-release

Conversation

@vmillet-dev

Copy link
Copy Markdown
Owner

Closes #1436. The outcome is a measurement, not a smaller binary: every way to shrink it that was tried slowed the application, and speed comes first (as the maintainer asked). The release profile stays opt-level = 3, fat LTO, one codegen unit, stripped.

Baseline (Linux, stripped release build): 78.6 MB; 787 crates in the graph of app. Packages, from packages.yml: AppImage 40.7 MB, .deb 33.5 MB, .rpm 25.9 MB.

Each option, measured on the same machine (cargo bench -p engine, 8000 notes of ~13 kB; the text crate's Prettier and highlighting timings):

opt-level Binary query_notes Cookie jar Argon2 unlock Prettier 13 kB p95 1 MB TS coloured
3 (kept) 78.6 MB 697 ms 0.63 ms 163 ms 653 ms 2.1 s
2 76.0 MB 744 ms 0.84 ms 152 ms 598 ms —
s + C code and KDF at 3 62.4 MB 955 ms 1.09 ms 220 ms 662 ms 2.3 s
s 61.0 MB — — — 788 ms 3.2 s
z 57.2 MB — — — 813 ms 3.1 s
  • s, z, 2: rejected. −20 % of binary costs +37 % on every query and +74 % on the cookie jar; 2 buys −3 % for +7 % to +34 % on the same paths.
  • Per-crate opt-level under s: rejected. It reaches the C built by cc (QuickJS, onig, SQLite — Prettier and highlighting came back to their speed) but not Rust under fat LTO: Argon2 and BLAKE2 left at 3 were still 35 % slower.
  • panic = "abort": rejected (~5 MB of unwinding tables): D18 catches a panic on the queues.
  • Dependencies: every declared one is used (a scan of each crate's sources: libsqlite3-sys is there for bundled). Default features are already off where it matters (eframe, egui, image, tokio, reqwest, rustls, zip, syntect, merman, resvg, rfd…). Where the size is: Mermaid and what it draws with ~11 MB, the interface 5.6 MB, D-Bus (tray, notifications, screen reader) 3.2 MB, wgpu/naga ~3 MB, embedded assets ~6 MB. Removing a Mermaid feature (math: 0.8 MB) or the GLES backend (~0.35 MB) would lose a diagram or a GPU for under 1 MB each: not done.
  • Duplicates: each is pulled by a dependency we do not control — reqwest 0.12 (the updater client), usvg/fontdb (merman), dirs 5 and 6 (the updater, auto-launch: bumping ours to 7 removes none), calloop/smithay-client-toolkit (winit against the clipboard), build-time crates.

What changes

  • lint-rust now refuses puffin and puffin_http in the default build of app, as it already refused egui_inspection (checked locally: absent without the feature, egui_inspection present with --features e2e).
  • docs/architecture.md, « The release binary » under Releasing: the table, each rejected option with its figure, where the size is, the duplicates that stay. A comment on [profile.release] points to it.

Tests

  • The figures above: release builds and cargo bench -p engine --bench commands (--sample-size 10) at each level, crates/text's budget test and a Prettier timing at each level.
  • npx prettier --check; the CI step runs on this pull request.

Generated by Claude Code

Each opt-level was measured against the core's benchmarks and the text
crate's timings; every smaller one slowed the queries. The figures, the
rejected options and where the size goes are in architecture.md. CI
refuses puffin and puffin_http in the default build, as egui_inspection.

Closes #1436

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U9wKqFskQrYXJ3B9dcPcRQ
@vmillet-dev vmillet-dev changed the title Release binary: dependencies and features trimmed to what is used Release binary: size weighed against speed, the fast profile kept Nov 9, 2026
@vmillet-dev
vmillet-dev merged commit 6f1d767 into dev/1.0.0 Nov 9, 2026
8 of 9 checks passed
@vmillet-dev
vmillet-dev deleted the claude/trim-release branch November 9, 2026 21:16
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.

2 participants