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

Compile yew-macro to WebAssembly. #1264

Open
teymour-aldridge opened this issue May 25, 2020 · 4 comments
Open

Compile yew-macro to WebAssembly. #1264

teymour-aldridge opened this issue May 25, 2020 · 4 comments
Labels
A-yew-macro Area: The yew-macro crate feature-request A feature request

Comments

@teymour-aldridge
Copy link
Contributor

teymour-aldridge commented May 25, 2020

Is your feature request related to a problem? Please describe.
A way to speed up yew-macro's compilation time would be to compile it to WebAssembly, ship the WASM binaries with the crate and then run them.

Describe the solution you'd like
I imagine that this would be achieved with dtonlay's watt library.

Describe alternatives you've considered
This could initially be placed behind a feature flag.

Additional context
I'd like to do this, just wondering whether it was something worth doing before writing any code!

@teymour-aldridge teymour-aldridge added the feature-request A feature request label May 25, 2020
@teymour-aldridge
Copy link
Contributor Author

I've made a stab at this on this branch https://github.com/teymour-aldridge/yew/tree/watt

@Xavientois
Copy link
Contributor

So, instead of the users of the crate compiling to their native target when they build the crate, it would be built ahead of time and just run when the user uses the macro crate?

Wouldn't that only improve performance the first time the crate would have been built? After that the natively compiled crate would be faster, no?

Maybe I'm just not understanding the impacts of this

@teymour-aldridge
Copy link
Contributor Author

https://github.com/dtolnay/watt lays out more of the specifics. Generally the macro is compiled in release mode, so it's faster.

@Xavientois
Copy link
Contributor

Xavientois commented Jul 3, 2021

https://github.com/dtolnay/watt lays out more of the specifics. Generally the macro is compiled in release mode, so it's faster.

Would adding the following line to packages/yew/Cargo.toml achieve a similar effect?

[profile.dev.package.yew-macro]
opt-level = 3

Because its WASM, it will work on any machine?

@mc1098 mc1098 added the A-yew-macro Area: The yew-macro crate label Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-yew-macro Area: The yew-macro crate feature-request A feature request
Projects
None yet
Development

No branches or pull requests

3 participants