Performance issue when returning values from WASM service to JS client #3643
Replies: 2 comments 1 reply
-
I know absolutely nothing about gRPC, but at a quick glance your problem seems to be the extra copying you do when converting a |
Beta Was this translation helpful? Give feedback.
1 reply
-
I am going to close this because I think that there is an issue with the crate 'tonic-web-wasm-client' that I am using. I will be downloading and testing this crate with my project to see where the issue is. Thanks for taking a look and all the work you and everybody does on this project! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I have a question around wasm-bindgen and how WASM works in general. I currently have a project where I am testing the performance of REST and gRPC from a web client. This project is open source on github (https://github.com/NathanielPrescott/Performance) and I am running it locally. I have noticed a few things that I currently don't fully understand. If I make a call to a basic function on my clients WASM service that returns a String then it will take around 0.1ms or less time per call. When I make a REST call to my service, where I am returning a reduced quality Image (Small 0.55Mb), the response returns in around 1.5ms. While when I make a call with the same image via my gRPC WASM service I find that the call takes on average 5.9ms which is dramatically slower. This timing issue gets exponentially worse for the higher resolution images. I found that I can't perform any timing testing within the gRPC WASM service due to some WebAssembly limitations, if I'm wrong about this please let me know. As I was looking into the gRPC WASM service, with Chromes network tab, I found that the call for the Small GetImage gRPC call is being done in around 1.3ms which is much closer to what I would expect this to take. Is this expected for WASM calls to be doing extra things in the background that slow down responses or is this an issue where WASM is struggling with converting the response to a JS format? The image is a Vec in rust and then gets converted to a Uint8Array for javascript.
I am currently learning Rust and very interested in using WASM with it so wanted to use this project as my first learning experience outside of reading the book. If this issue would be better posted on the github wasm-bindgen issues or if this is another issue not related to wasm-bindgen then please let me know. Thank you for your time.
Beta Was this translation helpful? Give feedback.
All reactions