by azakai · 4y ago · 0 comments
Wasm overhead is somewhere in the range of 50% (1.5x slower) to 14% (1.14x slower). Sources:
* https://www.usenix.org/system/files/atc19-jangda.pdf
* https://kripken.github.io/blog/wasm/2020/07/27/wasmboxc.html
It is true you can find a specific benchmark where wasm is 3-5x slower, say if the original uses highly-tuned x86 SIMD or relaxed atomics (or if the wasm version has SIMD or threads turned off entirely). But in general, the overhead is much lower.
BTW, if there is a problem with the current WASM performance, it's probably SIMD.
Again, based solely on my own benchmarks, exclusively in the area I'm interested in (game-type workload, so, say, multiplying many small matrices, performing geometric tests), there is little to no speed-up from wasm-simd128 (where it is supported), whereas native code compiled from the same sources, by the same compiler, profiled on the same machine, seems to be running a bit faster when vectorized.
This guy found sqlite to be 19x slower. https://ricomariani.medium.com/wasm-sqlite-for-web-products-...
(SQLite stresses not just wasm but also other Web APIs, like storage, which might explain different results in different types of benchmarks.)
But is this a failing of wasm or the system glue layer, that for something like sqlite/web has to go through js/browser/etc?
Yes, I understand the importance of real-life tests like this, but how one is expected to go about testing wasm performance as such other than using benchmarks that are mostly arithmetic/logic and not syscall-type code?