From f4a26ff8feef20eb91e2c77c8daf9525ccb3e7ec Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 1 Mar 2022 09:11:18 -0500 Subject: [PATCH] Os 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 --- Cargo.toml | 4 ++-- build.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 378ebc1..41166a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,14 +9,14 @@ crate-type=["cdylib"] [profile.release] debug = false codegen-units = 1 -opt-level = "z" #optimize for size +opt-level = "s" #optimize for size lto = true strip = true [profile.dev] debug = true codegen-units = 1 -opt-level = "z" #optimize for size +opt-level = "s" #optimize for size lto = true [dependencies] diff --git a/build.sh b/build.sh index 0536fe4..82db915 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e 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 llvm-strip --strip-all pkg/integral_site_bg.wasm