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

WASM file size? #1

Open
ivnsch opened this issue Aug 3, 2021 · 1 comment
Open

WASM file size? #1

ivnsch opened this issue Aug 3, 2021 · 1 comment

Comments

@ivnsch
Copy link

ivnsch commented Aug 3, 2021

Thanks for creating this template!

Creating the release build, as specified in the readme, shows this warning:

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
fonts/fa-solid-900.svg (775 KiB)
images/[email protected] (575 KiB)
images/[email protected] (354 KiB)
images/pfbg_2000.jpg (270 KiB)
main.js (1.17 MiB)
main.wasm (2.04 MiB)

Notably: main.wasm (2.04 MiB)

I checked the Yew optimizations guide (https://yew.rs/advanced-topics/optimizations#cargotoml) and was able to reduce it to 1.17 MB by adding this to the cargo.toml:

[profile.release]
# less code to include into binary
panic = 'abort' 
# optimization over all codebase ( better optimization, slower build )
codegen-units = 1
# optimization for size ( more aggressive )
opt-level = 'z' 
# optimization for size 
# opt-level = 's' 
# link time optimization using using whole-program analysis
lto = true

Still, 1.17 MB seems large (without all the assets). Would it be feasible to work on optimizing this template (including e.g. inspecting the binary with Twiggy)?

@ctron
Copy link
Member

ctron commented Aug 3, 2021

That sounds like a great improvement. Would you mind creating a PR for this?

I agree that especially the WASM binary could be smaller. If you have any ideas, I would definitely welcome them.

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