galacean / physX.js

Javascript bindings for Nvidia PhysX based on Embind
Other
25 stars 4 forks source link

Opt physX wasm lib size. #2

Open GuoLei1990 opened 3 years ago

GuoLei1990 commented 3 years ago

Embind will generate JS code to import wasm binary. we can bind the API as we need to reduce wasm binary size. And the size of glue file will not change dramatically.

yangfengzzz commented 3 years ago

Is there possible to call compiler in editor and only include necessary binding API to reduce the size of wasm binary.

yangfengzzz commented 3 years ago
// Optimize for size.
wasm-opt -Os -o output.wasm input.wasm

// Optimize aggressively for size.
wasm-opt -Oz -o output.wasm input.wasm

// Optimize for speed.
wasm-opt -O -o output.wasm input.wasm

// Optimize aggressively for speed.
wasm-opt -O3 -o output.wasm input.wasm

ref: code-size