Os vs Oz, size wise, only is about 100kb difference. but Oz disables some optimizations. Enabling Os instead of Oz brings the binary size up from 876527 bytes to 972775 bytes (a 10.9% increase).

Note: I am referring to wasm binary size as that's the main focus of this project
This commit is contained in:
Simon Gardling 2022-03-01 09:11:18 -05:00
parent b28b81950d
commit f4a26ff8fe
2 changed files with 3 additions and 3 deletions

View File

@ -9,14 +9,14 @@ crate-type=["cdylib"]
[profile.release] [profile.release]
debug = false debug = false
codegen-units = 1 codegen-units = 1
opt-level = "z" #optimize for size opt-level = "s" #optimize for size
lto = true lto = true
strip = true strip = true
[profile.dev] [profile.dev]
debug = true debug = true
codegen-units = 1 codegen-units = 1
opt-level = "z" #optimize for size opt-level = "s" #optimize for size
lto = true lto = true
[dependencies] [dependencies]

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
wasm-pack build --target web --release --no-typescript wasm-pack build --target web --release --no-typescript
wasm-opt -Oz -o pkg/integral_site_bg_2.wasm pkg/integral_site_bg.wasm wasm-opt -Os -o pkg/integral_site_bg_2.wasm pkg/integral_site_bg.wasm
mv pkg/integral_site_bg_2.wasm pkg/integral_site_bg.wasm mv pkg/integral_site_bg_2.wasm pkg/integral_site_bg.wasm
llvm-strip --strip-all pkg/integral_site_bg.wasm llvm-strip --strip-all pkg/integral_site_bg.wasm