What is WebAssembly?
WebAssembly (abbreviated WASM, pronounced waz-um) is one of the most interesting emerging technologies. WASM allows many different programming languages to be compiled to the Web and run in the browser. In addition, it provides a high-performance complement to JavaScript (up to 20x faster). Startups like Figma and Zoom today are already using WASM to provide new and faster experiences on the Web.
I break down the benefits, what's currently supported, who's using it, and some of my predictions.
Benefits
Cross-compile languages to binaries that can be executed natively on the Web in browsers.
20x faster performance than Javascript, 3x faster than asm.js (roughly)
Portable sandboxing of untrusted code (browser or server-side)
Programming languages with production-level WASM support
Go (Native toolchain, TinyGo)
C/C++ (Emscripten)
C# (Blazor)
Rust (Native toolchain)
Use cases
Zoom. Zoom uses WebAssembly SIMD (single instruction, multiple data) to optimize audio/video codecs and image processing. When Zoom creates a virtual background or decoding audio, it is using WASM. There were already standards for real-time communication on the Web through WebRTC. Still, Zoom needed to access low-level APIs to provide the desired level of performance (which is why Zoom seems to work so much smoother than past video conferencing solutions).
Figma. "WebAssembly cut Figma's load time by 3x". Figma's main engine is written in C++ and was transpiled to asm.js, a subset of Javascript. WASM provided a drop-in replacement for asm.js
New Ideas and Predictions
WebAssembly server-side, outside the browser. WebAssembly System Interface (WASI) is a modular system interface for WebAssembly focused on security and portability. Think of it as an extension that focuses on operating-system-like features. WASI is independent of browsers and doesn't depend on Web APIs or JavaScript.
Deno is a secure runtime for JavaScript and TypeScript written in Rust. It can execute WASM modules with the same interfaces that browsers provide.
Wasmer provides a runtime to execute WASM for running on different operating systems or embedding it into other languages.
The value proposition of server-side WASM is the portable execution of untrusted code. Here's was Docker co-founder Solomon Hykes had to say in 2019 about WASI vs. containers.