WebAssembly(esp AOT) is magic !! We can change the thread title from "asm js too slow" to "wasm too fast"!!
"50X slowdown of chrome in asm.js" as compared to native has not turned to "3X slower than native" for chrome in WebAssembly
Here is my account of WebAssembly:
Status on Chrome Canary
WASM is 3X slower than native at runtime (with exceptions disabled).
The performance is predictable for WASM (for asm.js there is a huge variance - 10X to 50X slower as compared to native)
With exception enabled, it is 4X slower than native(faster than chrome here) - Does it mean "zero cost exceptions" has already been implemented in Chrome for WASM (but not in FF yet) ? Interestingly c++ exceptions did not create much difference in asm.js version of chrome too
Status on FF Nightly
(FF main released yesterday is lagging a little behind latest FF nightly in performance)
WASM is 2X slower than native at runtime (with exceptions disabled)
The performance is predictable for both asm.js and WASM (very less variance)
With exception enabled FF is 6X slower as compared to native (slower than chrome here)
Allow Memory Growth
This was a big area of concern for asm js developers and I tested it with WASM.
There is zero overhead on performance if this option is set (when the application does not try to grow the memory) for both the browsers !! In asm js world, just compiling with this option disabled many optimizations and has adverse impact on performance even if the memory growth never occured (and browsers removed its support) !! But I did not find any affect in latest browser WASM In my tests.
I did not test thoroughly what happened when "memory growth is forced on the application" but it appeared to be very fast to me. In any case -I would guess if you allocated too much memory you will hit browser limits like aw - snap on trying to allocate too much memory in chrome too quickly without releasing the event loop. Or you may reach 2gb browser limit etc
It would be interesting to know how this problem was addressed ? What are the experience of others in trying this option in WASM ?
This was all about desktop testing.
Perhaps I will write my analysis about mobile performance too when I am on it. Should I expect a slowdown in the ratio of jetStream JS benchmark for those devices when compared to native ? Or more than that due to size of application (JetStream test is done with smaller JS files)
Thanks