3 ms·
> While I haven't performed any benchmarks about whether Rust or JavaScript processing is faster, I decided to use Rust and WebAssembly because there will be a
by beeboobaa 3y ago
> While I haven't performed any benchmarks about whether Rust or JavaScript processing is faster, I decided to use Rust and WebAssembly because there will be a lot of coordinates to process, and Rust generally performs faster at large amounts of data processing.
Is this really true for Rust compiled to WebAssembly in the browser?
- davidmurdoch 3y agoDepends on the data types and if the WASM code can make use of SIMD.
- grovesNL 3y agoIt depends on the use case (e.g., how much you're interacting with web APIs) but I'd generally expect this to be the case for data processing at least. During compilation from Rust to WebAssembly you have the opportunity to apply ahead-of-time optimizations that would be too expensive or impossible to apply to JavaScript during execution, so this can improve performance pretty significantly over JavaScript.
- afavour 3y agoIt’s an interesting question. When it comes to processing large amounts of data I’d actually be more concerned about JavaScript’s memory usage than strict processing performance. Certainly you could use JS smartly with typed arrays and such to minimise memory impact but you'd basically be manually creating a lot of the convenience that Rust gives you out of the box.