I keep seeing GitHub issues of people just like me trying to figure out what WebAssembly (Wasm) and previously
A bit of background on Wasm
Wasm was originally created for so much more than just performance. Wasm is about providing a proper compile target for native code to get into the browser. In the earlier stages of the development cycle, Wasm was actually
After quite a bit of searching and review, I found a few people who have done research into Wasm's runtime performance specifically by using benchmarks:
- In a joint Google, Mozilla, Microsoft, and Apple paper (May 2017) (also mentioned in that blog post by Adrian Colyer updating the wider Internet community, Wasm was found to perform close to but still less than C code for runtime of certain benchmarks. Taking test cases from the PolyBenchC library, the paper found that Wasm ran within 2x of native speeds in most cases and for some within 10%. I don't think you're going to get much better than that given the use case of Wasm and it being more abstracted and safe than actual compiled C code. The paper also found that Wasm is 33.7% faster for these same test cases than
asm.js(March 2017), calling out multiple features that Wasm can use over
asm.jsand the future of what Wasm can add. And while he provides lower estimates (specifically, 5% speedup between Wasm and
asm.js) this is due to testing
asm.jsthat was ported to Wasm, and not direct Wasm compilation.
- The game engine Unity3D has seen improvements in using Wasm in a 2018 benchmark over their 2015
asm.jsbenchmark. Their 2018 post goes quite into detail over a lot of little changes they've observed.
- One final article to check out.
This gives me a good feeling. Wasm will give you some performance increase but only for applications with datasets that require it. Building websites probably won't be moving to Wasm anytime soon.