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

Reduce build size for WASM #92

Open
ivnsch opened this issue Aug 3, 2021 · 0 comments
Open

Reduce build size for WASM #92

ivnsch opened this issue Aug 3, 2021 · 0 comments

Comments

@ivnsch
Copy link
Contributor

ivnsch commented Aug 3, 2021

Minimal example project: https://github.com/ivanschuetz/algorand-yew-example

Release version .wasm file size (trunk build --release):

  • Without Algonaut, without optimization: 207 KB
  • Without Algonaut, with optimization: 143 KB
  • With Algonaut, without optimization: 967 KB
  • With Algonaut, with optimization: 770 KB

Where the optimization is:

[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

(See also https://yew.rs/advanced-topics/optimizations#cargotoml)

These file sizes are obviously not ideal. E.g. building with npm/wasm-pack shows this warning:

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).

We should inspect which of our dependencies are responsible for this and see how we can improve it, in worst case and possible, replacing them with leaner (or web specific) dependencies. ring could be a good place to start, which is causing problems with WASM anyway (#59).

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

1 participant