Skip to content

perf(wasm): add min package and reduce wasm size#971

Open
lodyai[bot] wants to merge 3 commits intomainfrom
wasm-min-size-optimization
Open

perf(wasm): add min package and reduce wasm size#971
lodyai[bot] wants to merge 3 commits intomainfrom
wasm-min-size-optimization

Conversation

@lodyai
Copy link
Copy Markdown
Contributor

@lodyai lodyai Bot commented Apr 28, 2026

Summary

  • add a loro-crdt/min package build that disables debug hooks, JSON schema validation, and JSONPath-related wasm APIs
  • replace the Deno wasm build scripts with Justfile recipes and add a conservative wasm-opt pass
  • vendor generic-btree so wasm-size changes can be made locally, remove unused dependencies, and reduce generic/inline bloat
  • relax broad #[inline(always)] usage across shared crates to reduce wasm monomorphization pressure

Validation

  • cargo test -p generic-btree --lib
  • cargo fmt --check --package generic-btree
  • just build-wasm release min bundler
  • node WebAssembly.compile on crates/loro-wasm/min/bundler/loro_wasm_bg.wasm
  • cargo fuzz run random_import -- -max_total_time=60 passed 4,573,622 runs
  • cargo fuzz run local_events -- -max_total_time=60 passed 6,029 runs

Size

  • loro-crdt/min bundler wasm: raw 1,987,971 bytes, gzip 643,797 bytes, brotli 486,691 bytes

@lodyai lodyai Bot force-pushed the wasm-min-size-optimization branch 2 times, most recently from c4ad503 to b8106d9 Compare April 28, 2026 03:56
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

WASM Size Report

  • Original size: 3052.31 KB
  • Gzipped size: 977.46 KB
  • Brotli size: 685.80 KB

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

WASM Min Size Report

  • Original size: 1942.87 KB
  • Gzipped size: 628.98 KB
  • Brotli size: 475.58 KB

@lodyai lodyai Bot force-pushed the wasm-min-size-optimization branch from b8106d9 to bdb3906 Compare April 28, 2026 04:11
@lodyai lodyai Bot force-pushed the wasm-min-size-optimization branch from cc81c40 to 55d14d7 Compare April 30, 2026 13:01
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