Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim down the wasm deploy size #47

Open
sophiajt opened this issue Jul 30, 2020 · 2 comments
Open

Trim down the wasm deploy size #47

sophiajt opened this issue Jul 30, 2020 · 2 comments

Comments

@sophiajt
Copy link
Contributor

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
Copy link
Collaborator

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
Copy link
Collaborator

jzaefferer commented Aug 1, 2020

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

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

No branches or pull requests

2 participants