-
Notifications
You must be signed in to change notification settings - Fork 333
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 #557
Comments
The Unicode tables used for IDNA come to mind, but there is no plan to make those optional. https://github.com/rustwasm/twiggy is made to investigate exactly this kind of question. Let us know what you find. |
Thanks!
WASM without rust-url
WASM with rust-url
Differences
So if I created
Do you think that there is a workaround? Or am I able to "hack" it somehow in my fork at reasonable time? - I.e. Should I try to find a solution? Thank you. |
I was thinking of the
What kind of workaround do you mean? Those tables are required to correctly implement the parsing algorithm according to the spec. Or if you want another to fork the |
Do you think that some optimizations would help to reduce
I hoped that we can leverage some native browser APIs like Encoding API or even URL.
I have practically zero knowledge about this domain / this project architecture, so thanks for explanation.
|
That’s really hard to say without trying it
For wasm-in-the-browser that may possible. But it’s an entirely different project form this crate. |
I just found this issue and seeing how the |
How would that work? Wasm doesn't have direct access to browser API s. |
In a Here's what getrandom does 1, 2, for example. Browser support is usually put behind a feature, so that downstream users can specify whether they are using the Some projects also use |
Libraries that use |
@SimonSapin why do you feel that way? It's not clear to me how this would work. If people would like to use browser APIs just for the unicode data tables, it seems like they would have to duplicate the entire URL parser and IDNA logic on their side. But perhaps you meant that folks could just use the browser's built-in URL parser when their code is running inside the browser? |
Yes, using the browser’s URL parsing is what I had in mind: https://url.spec.whatwg.org/#api |
What I can see has happened here so far:
There's still a significant footprint from the I feel that disabling IDNA support is a band-aid solution to the problem in WASM - the JavaScript/Web
One could instead patch out the Binding
The trouble is If it was part of the standard library, the toolchain could just swap the But for a crate outside of the standard library - it's not the toolchain's problem to solve. In the end, any WASM-specific implementation would need to end up on the |
My PR to reimplement the internals on top of ICU4X makes the Wasm size smaller. |
The wasm size should now be smaller with |
Hi,
when I include this library to the Seed app and then compile and optimize it => the output WASM file size changes from 466 to 745 KB (+279 KB).
Do you know how to reduce it? (feature flags, dependency changes, etc.)
Thank you!
The text was updated successfully, but these errors were encountered: