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 optimization #599

Closed
kellytk opened this issue Aug 17, 2019 · 5 comments
Closed

WASM file size optimization #599

kellytk opened this issue Aug 17, 2019 · 5 comments
Labels

Comments

@kellytk
Copy link
Contributor

kellytk commented Aug 17, 2019

I'm submitting a ...

  • feature request

WebAssembly is the future of web-based code distribution but its files are large. The large file size imposes an unfavorable cost to first-x performance metrics such as first contentful paint.

How could that problem be optimally solved and which pieces of the Yew+wasm-bindgen+wasm-pack+bundler stack would it involve?

Possible Solution

Introduce a method of annotating component trees with something like a load priority. Each load priority scope would become a separate WASM file. When the app is loaded, its WASM files would be loaded based on their load priority. load priority would need to be overridable by user demand. For example, if a dropdown menu is marked low priority and it hasn't loaded by the time a user clicks the menu's button to present it, it would be immediately fetched, mounted, then presented.

@Boscop
Copy link

Boscop commented Sep 13, 2019

Someone recommended wasm-opt to me.
With opt-level = "z" you degrade performance to get a small size.

@kellytk
Copy link
Contributor Author

kellytk commented Sep 28, 2019

Regarding the possible solution I suggest above, a lazy load priority would probably be helpful for features that should not be loaded until used.

@kellpossible
Copy link
Contributor

just out of interest, what is the smallest binary size someone has managed to achieve with Yew (even a simple hello world)?

@jstarry
Copy link
Member

jstarry commented Apr 22, 2020

@kellpossible not yet! I'd love to start tracking that!

@kellytk kellytk closed this as completed Apr 28, 2021
@evbo
Copy link

evbo commented Jun 7, 2022

@kellytk I read the above linked roadmap but am not seeing "lazy load" as a feature. How did this get implemented now, is there a way to lazy parts of a Yew application for faster startup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants