Skip to content

Commit e60772c

Browse files
committed
add size shrinking
1 parent ba69cc6 commit e60772c

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

05-game-of-life/Cargo.toml

+8-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,11 @@ features = [
4242

4343
[profile.release]
4444
# Tell `rustc` to optimize for small code size.
45-
opt-level = "s"
45+
# opt-level = "s" # 37143
46+
lto = true
47+
opt-level = "z" # wasm-opt -Oz # https://rustwasm.github.io/book/reference/code-size.html#use-the-wasm-opt-tool
48+
# gzip -9 < pkg/game_of_life_bg.wasm | wc -c
49+
50+
# publish
51+
# wasm-pack login
52+
# wasm-pack publish

05-game-of-life/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ A zero-player game to learn how to use Rust, WebAssembly, and JavaScript togethe
1616
- pausing and resuming the game.
1717
- toggling a cell's state on click.
1818
- optimizing performances with time profiling and benchmarking.
19+
- shrinking .wasm size with wasm-opt and gzip.
1920

2021
Based on [The Rust and WebAssembly Book](https://rustwasm.github.io/docs/book/) by The Rust and WebAssembly Working Group (2021).

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,6 @@ A zero-player game to learn how to use Rust, WebAssembly, and JavaScript togethe
107107
- pausing and resuming the game.
108108
- toggling a cell's state on click.
109109
- optimizing performances with time profiling and benchmarking.
110+
- shrinking .wasm size with wasm-opt and gzip.
110111

111112
Based on [The Rust and WebAssembly Book](https://rustwasm.github.io/docs/book/) by The Rust and WebAssembly Working Group (2021).

0 commit comments

Comments
 (0)