Skip to content

🧼 optimize wasm build with -Oz and wasm-opt#47

Draft
natemoo-re wants to merge 2 commits into
mainfrom
ref/wasm-opt
Draft

🧼 optimize wasm build with -Oz and wasm-opt#47
natemoo-re wants to merge 2 commits into
mainfrom
ref/wasm-opt

Conversation

@natemoo-re
Copy link
Copy Markdown
Member

Building on #35, reduces npm install size by ~27% (270 kB → 196 kB unpacked) via:

  • switches clang from -O2 to -Oz (optimize for size over speed)
  • adds a wasm-opt -Oz post-pass on the compiled binary, shrinking clayterm.wasm from 152 kB → 98 kB
  • WASM_OPT is configurable via env var if the tool isn't in PATH (defaults to wasm-opt)

Trade-off: -Oz prioritizes size over speed; runtime performance impact is unknown. That's why we added benchmarks in #43.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 28, 2026

Open in StackBlitz

npm i https://pkg.pr.new/clayterm@47

commit: c3a2983

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq Bot commented May 28, 2026

Merging this PR will degrade performance by 24.69%

❌ 5 regressed benchmarks
✅ 13 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
diff render (second frame) 712.2 µs 1,042.6 µs -31.7%
simple text 184 µs 255.9 µs -28.09%
bordered box with corner radius 223.3 µs 279.5 µs -20.13%
dashboard layout 437 µs 597.7 µs -26.89%
render with pointer hit testing 274.6 µs 325.1 µs -15.53%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ref/wasm-opt (c3a2983) with main (4139212)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant