Optimize for size over performance If size is more important than performance, you can use -Os flag.
I tried with camaro and the file size reduce from 176KB down to 130KB. It’s worth a try.
Disable assertion, debug Try adding these flags: -s ASSERTIONS=0 and -DNDEBUG to emcc.
Using emmaloc Try using emmalloc …
I released my first WebAssembly module here on GitHub. Here are some lessons I learnt during the process. Please don’t take it for granted. These things might be true, or not. I’m not sure. I just worked on it for the last few days.
Cache WebAssembly instance to save some time on initialization const Module …
WebAssembly Binary Toolkit - Easiest way to setup WebAssembly binary toolkit. Or if you prefer to manually install it.
wat2js - Compile WebAssembly .wat files to a common js module
WebAssembly spec - WebAssembly Specification
Some examples modules