diff --git a/Cargo.toml b/Cargo.toml index 808dc626..eabc13f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,3 +22,5 @@ egui_web = { path = 'egui_web' } # opt-level = 1 # very slow and big wasm. Don't do this. opt-level = 2 # fast and small wasm, basically same as `opt-level = 's'` # opt-level = 3 # unecessarily large wasm for no performance gain + +# debug = true # include debug symbols, useful when profiling wasm diff --git a/build_demo_web.sh b/build_demo_web.sh index a40772c2..b76eeac8 100755 --- a/build_demo_web.sh +++ b/build_demo_web.sh @@ -30,8 +30,11 @@ wasm-bindgen "target/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" \ --out-dir docs --no-modules --no-typescript # brew install wabt # to get wasm-strip -wasm-strip docs/${CRATE_NAME}_bg.wasm +# wasm-strip docs/${CRATE_NAME}_bg.wasm -echo "Finished: docs/${CRATE_NAME}_bg.wasm" +echo "Optimizing wasm…" +# brew install binaryen # to get wasm-opt +wasm-opt docs/egui_demo_app_bg.wasm -O2 --fast-math -o docs/egui_demo_app_bg.wasm # add -g to get debug symbols +echo "Finished docs/${CRATE_NAME}_bg.wasm" open http://localhost:8888/index.html