nushell / demo

Experimental wasm-based Nu playground
https://www.nushell.sh/demo/
MIT License
23 stars 10 forks source link

Trim down the wasm deploy size #47

Open sophiajt opened 4 years ago

sophiajt commented 4 years ago

Looks like there are some tips here: https://rustwasm.github.io/book/reference/code-size.html

For how we might be able to optimize the code size of the wasm we transmit.

jzaefferer commented 4 years ago

This means that if you're using instantiateStreaming the second the Web request is done the WebAssembly module is probably ready to go.

That sounds interesting - faster load time without optimizing the file itself.

jzaefferer commented 4 years ago

This means that if you're using instantiateStreaming the second the Web request is done the WebAssembly module is probably ready to go.

That sounds interesting - faster load time without optimizing the file itself.

Now that I've looked around: As far as I can tell, webpack already makes use of that: https://github.com/webpack/webpack/pull/7144/files

Otherwise, they mention setting opt-level = 's', which we already have in place. I justed tested adding lto = true - that increased the size of pkg/wasm_nu_bg.wasm by about 9kb.

Actually profiling the size might yield more insight what can be optimized, but that's too far outside my zone: https://rustwasm.github.io/book/reference/code-size.html#the-twiggy-code-size-profiler