WebAssembly and Rust: performance analysis
polaris64.net
polaris64.net
It would be interesting to replace f64 with f32 in the Rust code and see how much difference that makes. Unfortunately there's no --ffast-math in Rust yet AFAIK.
[1]: https://github.com/WebAssembly/host-bindings/blob/master/pro...
The last frame took 0.012999999999738065ms to render.
Is there a timer with that resolution? Is this an average over 1000 frames? Doesn't seem like it.
Plus, there is no such thing that I know of that is a WebGL program. WebGL is a library that JS or WebAssembly program use to get access to the GPU. So I guess what he is saying is that be moving the calculations to the GPU he got a huge speed up. What's the news there?
"Currently, running the demonstration in the latest versions of both Chrome and Firefox on Linux, with an integrated Intel GPU, shows that the WebGL version is the fastest, as expected. Interestingly however, the performance of the WebAssembly version matches the plain JavaScript version almost exactly!"
Been developing WebGL for years. I've never seen any difference in performance with gl.finish() and without vsync. I would expect some difference because the JS code wouldn't be running in parallel with gl.finish().
The only way I have been able to measure performance is to look at the FPS without vsync (chrome --disable-gpu-vsync).
jsheard mentioned that the WebGL code is using single-precision floating point and some rough optimizations, while the JS and WASM are using double-precision floats and no such optimization. I wonder why you wouldn't see a difference if that's the case, since the result should be worse.