Web download: 4.5 MB of wasm, a quarter of it debug info #231

Closed
opened 2026-10-21 19:08:07 +00:00 by littlefox · 1 comment
Owner

Found in the codebase review (#230, D-058).

The release web build (dx build --platform web --release, as the image does it) gives a neokom_bg-*.wasm of 4.49 MB (1.22 MB gzip, 0.95 MB zstd as Caddy serves it). It was 2.39 MB on 2026-10-16, so it nearly doubled in five days. Sections of the current build:

section bytes
code 2 705 803
data 437 906
.debug_str 767 519
.debug_info 389 760
.debug_line 125 502
other .debug_* 29 285

So about 1.3 MB is DWARF debug info, which no user needs. The workspace Cargo.toml has no [profile.release] at all, so we get the defaults: opt-level 3, no LTO, 16 codegen units, no strip, unwinding panics.

To try, measuring size and the e2e suite for each step:

  • strip = "debuginfo" (or check why dx's wasm-opt step leaves the sections in);
  • lto = "fat", codegen-units = 1;
  • panic = "abort" for the wasm build;
  • opt-level = "z"/"s" for the web only (a [profile.wasm-release] dx can be pointed at), if speed holds;
  • what grew since 10-16: twiggy top/cargo bloat on the wasm. Look for generics instantiated many times and for the dependencies added in 0.4/0.5.

The desktop binary gets the same profile, so measure its size and startup too.

Also: a CI check that fails when the gzip size of the wasm grows past a set budget, so the next doubling is noticed when it happens.

Found in the codebase review (#230, D-058). The release web build (`dx build --platform web --release`, as the image does it) gives a `neokom_bg-*.wasm` of **4.49 MB** (1.22 MB gzip, 0.95 MB zstd as Caddy serves it). It was 2.39 MB on 2026-10-16, so it nearly doubled in five days. Sections of the current build: | section | bytes | |---|---| | code | 2 705 803 | | data | 437 906 | | `.debug_str` | 767 519 | | `.debug_info` | 389 760 | | `.debug_line` | 125 502 | | other `.debug_*` | 29 285 | So about **1.3 MB is DWARF debug info**, which no user needs. The workspace `Cargo.toml` has **no `[profile.release]`** at all, so we get the defaults: opt-level 3, no LTO, 16 codegen units, no strip, unwinding panics. To try, measuring size and the e2e suite for each step: - `strip = "debuginfo"` (or check why dx's wasm-opt step leaves the sections in); - `lto = "fat"`, `codegen-units = 1`; - `panic = "abort"` for the wasm build; - `opt-level = "z"`/`"s"` for the web only (a `[profile.wasm-release]` dx can be pointed at), if speed holds; - what grew since 10-16: `twiggy top`/`cargo bloat` on the wasm. Look for generics instantiated many times and for the dependencies added in 0.4/0.5. The desktop binary gets the same profile, so measure its size and startup too. Also: a CI check that fails when the gzip size of the wasm grows past a set budget, so the next doubling is noticed when it happens.
Author
Owner

Merged in #257; main run #426 green. The web build is 2.06 MB, 783 KB gzipped (from 4.49 MB, 1.22 MB). Verified: full e2e on three profiles (330 passed) with the size build; tools/perf.sh showed "s" and "z" equally fast; tools/wasm-size.sh runs in CI with a 900 KB budget.

Merged in #257; main run #426 green. The web build is 2.06 MB, 783 KB gzipped (from 4.49 MB, 1.22 MB). Verified: full e2e on three profiles (330 passed) with the size build; `tools/perf.sh` showed "s" and "z" equally fast; `tools/wasm-size.sh` runs in CI with a 900 KB budget.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
littlefox/neokom#231
No description provided.