WASM vs Native Rust performance

67 points hucancode

So I made a tool to that do heavy computation (simulating all possible outcome of a poker game).

Native version was ran with cargo run --release, it finish in 33s. The same input went through WASM version took 202s (3m22s), which is disappointing since it is not very much faster than my javascript code.

I use wasm-pack and Vite with wasm plugin to load the code and use it in javascript.

How was your experience? Did you get that much performance drop with WASM?

Edit: Some informations if they are relevant. I am doing 64bit bit mask logic here, millions of bit operations. I manage my loop with VecDeque instead of for loop. The code https://github.com/hucancode/poker-solver