-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
More efficient serialization of struct #65
Comments
Yeah that would be ideal approach, but it's not possible / compatible with Serde, as it describes all structs at runtime. The closest you can get is dynamically constructing and caching JS functions via Ideally static conversion like this should be implemented in wasm-bindgen itself or a separate proc-macro. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for making this crate!
I looked into its implementation a bit and have a possible improvement that I discuss here:
https://neugierig.org/software/blog/2024/04/rust-wasm-to-js.html
The tldr is you can avoid the
static_str_to_js
cache by instead codegenning a JS function per struct that you serialize, which would likely also better this JS VM object construction caches. Some sample code from my prototype sketch. I'm not certain it's possible within the serde architecture -- serde is still a bit overwhelming to me -- but I think maybe it's a small tweak onObjectSerializer
?In any case, I figured since you were interested in the performance of this area you might be interested in this. Feel free to close this bug if it doesn't suit you, I just figured this was the place to bring it to your attention.
The text was updated successfully, but these errors were encountered: