mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-14 19:26:51 -04:00
Web: wasm back under the 24 MiB gate with ~1 MiB headroom (25.38 -> 24.17 MB)
The "web build and wasm size gate" job failed on main and every PR: the release `_bg.wasm` measured 25,379,677 bytes at8d49ecf5, over the 25,165,824-byte limit in packaging/web/package.sh. - egui's default fonts (Ubuntu Light, Hack, Noto Emoji, emoji-icon-font) were embedded uncompressed (1.4 MB) by egui's `default_fonts` feature. The app now builds egui without it; ui-egui's build.rs deflates the same files from the `epaint_default_fonts` crate (a build-dependency, so no font files are committed) and `egui_fonts.rs` rebuilds egui's exact default stack from them on first use. Test builds keep the feature as the oracle: the rebuilt definitions equal egui's byte for byte. - Translation catalogs: every catalog repeated the same English sources. build.rs now stores the `context<TAB>source` keys once and each catalog as references plus translations, losslessly (`text()` still returns each .tsv byte for byte; malformed lines are kept as they are). - wasm-release profile: opt-level "z" for PhotoCraft's own crates. Dependencies stay at "s" (at "z" the wasm grew 0.4 MB, measured), the file-decoding crates (codecs, psd, raw, heif, vector) stay at "s" and the pixel crates at 3, so decoding and filters keep their speed. Measured with `trunk build --release` (trunk 0.21.14, wasm-opt v123 -Oz): upstream main8d49ecf525,379,677 bytes this change 24,167,186 bytes (-1,212,491) gate 25,165,824 bytes (998,638 headroom) Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
8d49ecf50d
commit
5a0e2e2658
12 files changed
+310
-57
No files matched your search
+21
-19
@@ -50,7 +50,9 @@ zune-core = "0.5"
|
||||
zune-jpeg = "0.5"
|
||||
proptest = "1"
|
||||
eframe = { version = "0.36", default-features = false }
|
||||
egui = "0.36"
|
||||
# Without `default_fonts`, which embeds egui's fonts uncompressed: ui-egui ships them deflated
|
||||
# (egui_fonts.rs; the web build's size gate).
|
||||
egui = { version = "0.36", default-features = false }
|
||||
egui_kittest = "0.36"
|
||||
rfd = "0.17"
|
||||
log = "0.4"
|
||||
@@ -81,13 +83,14 @@ codegen-units = 1
|
||||
|
||||
# The browser build (apps/photocraft-web, `data-cargo-profile` in its index.html). Hosts cap the
|
||||
# size of a single file (Cloudflare Pages/Workers: 25 MiB), and the wasm is downloaded on every
|
||||
# visit, so this profile optimizes for size: fat LTO, opt-level "z" for the UI, command, and I/O
|
||||
# shells, and "s" for other crates except pixel processing, which keeps opt-level 3. panic
|
||||
# stays the target default (wasm32-unknown-unknown aborts; AGENTS.md's `panic = "unwind"` is for
|
||||
# the native app shell). packaging/web/package.sh fails the build above 24 MiB.
|
||||
# visit, so this profile optimizes for size: fat LTO, opt-level "z" for PhotoCraft's own crates,
|
||||
# "s" for dependencies and for the crates that decode files, and 3 for pixel processing (filters
|
||||
# and compositing). Dependencies stay at "s": at "z" the whole wasm grows (by 0.4 MB, measured).
|
||||
# panic stays the target default (wasm32-unknown-unknown aborts; AGENTS.md's `panic = "unwind"`
|
||||
# is for the native app shell). packaging/web/package.sh fails the build above 24 MiB.
|
||||
[profile.wasm-release]
|
||||
inherits = "release"
|
||||
opt-level = "s"
|
||||
opt-level = "z"
|
||||
lto = "fat"
|
||||
codegen-units = 1
|
||||
strip = "debuginfo"
|
||||
@@ -95,20 +98,19 @@ strip = "debuginfo"
|
||||
[profile.wasm-release.package."*"]
|
||||
opt-level = "s"
|
||||
|
||||
# Keep the browser shell compact as shared panel controls grow. Pixel-processing crates below
|
||||
# retain their speed-oriented optimization level.
|
||||
[profile.wasm-release.package.photocraft-ui-egui]
|
||||
opt-level = "z"
|
||||
|
||||
# Keep browser command dispatch, import/export glue, and the entry point compact. Native
|
||||
# builds and the speed-oriented pixel-processing overrides below retain their settings.
|
||||
[profile.wasm-release.package.photocraft-engine]
|
||||
opt-level = "z"
|
||||
[profile.wasm-release.package.photocraft-io]
|
||||
opt-level = "z"
|
||||
[profile.wasm-release.package.photocraft-web]
|
||||
opt-level = "z"
|
||||
# Decoding and rasterizing keep their speed.
|
||||
[profile.wasm-release.package.photocraft-codecs]
|
||||
opt-level = "s"
|
||||
[profile.wasm-release.package.photocraft-psd]
|
||||
opt-level = "s"
|
||||
[profile.wasm-release.package.photocraft-raw]
|
||||
opt-level = "s"
|
||||
[profile.wasm-release.package.photocraft-heif]
|
||||
opt-level = "s"
|
||||
[profile.wasm-release.package.photocraft-vector]
|
||||
opt-level = "s"
|
||||
|
||||
# Pixel processing keeps its speed-oriented optimization level.
|
||||
[profile.wasm-release.package.photocraft-raster]
|
||||
opt-level = 3
|
||||
[profile.wasm-release.package.photocraft-color]
|
||||
|
||||
Reference in new issue
Block a user