WebAssembly is the Future of Software
Today, almost everyone who thinks they know what WebAssembly is is wrong.
WebAssembly is not a toy that runs in the browser to sometimes make your JavaScript go faster, no.
WebAssembly is the technology that is about to achieve something unprecedented in the history of software: we are on the cusp of being able to program in whatever programming language we want, compile our code to WebAssembly, and have it import code written in any language that’s also been compiled to WebAssembly! And that code will run absolutely everywhere – on every phone, every desktop, every server, every tablet, every browser – and do so super securely, thanks to WebAssembly’s nanoprocess model (see links below).
Plus WebAssembly (aka “WASM”) is solving real problems today:
But how can you run this third-party code in a fast and safe way? By using WebAssembly.
With [Shopify’s] new platform, built on top of Lucet, they’ve been able to run a flash sale with 120,000 WebAssembly modules spinning up and executing in a 60 second flash sale window, while maintaining a runtime performance of under 10 ms per module.
Source: https://bytecodealliance.org/articles/1-year-update
More info about WASM and WASI, the latter of which allows WASM to run outside the browser – where it belongs.
Articles and Talks
EDIT: Read this excellent article that reports findings and conclusions very similar to my own – “Pay Attention to WebAssembly”.
WASM
- “A Cartoon Intro to WebAssembly” – https://hacks.mozilla.org/2017/02/a-cartoon-intro-to-webassembly/
- Corresponding talk: https://www.youtube.com/watch?v=HktWin_LPf4
WASI
- https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/
- Talk about WASI: https://www.youtube.com/watch?v=fh9WXPu0hw8
Bad Arguments Against WebAssembly
“But WebAssembly introduces a 35% overhead compared to a native binary executable! This performance loss is unacceptable.”
The perf loss will mostly be for languages that are extremely insecure, namely C and C++, and the huge increase in security will convince a lot of people to use Wasm and take a small hit.
Computers vary by a LOT more than 35% in their speed relative to each other. Is a native binary running on your machine unacceptably slow if your machine is 35% slower than someone else’s?