A compilation target for executing in a virtual machine supported by web browsers and servers (via tools like wasmtime). WebAssembly is intended to be portable between platforms and has a similar ‘write once run anywhere’ ethos as Java. WebAssembly already runs significantly faster than JavaScript in the browser and there is reason to believe the gap will widen as WebAssembly support improves.
Current limitations include by native access to manipulating the DOM, compiling from garbage collected languages results in huge binaries, and performance (Firefox is the fastest). Rust has the most mature support for compiling to wasm.
See also:
- Progressive WebAssembly Applications (PWAA), a talk I gave about combining WebAssembly with progressive web apps as a possible future for app distribution
Links to this note
-
There are several projects that are using WebAssembly to run python in the browser. So far, the most useful looks to be running jupyter in the browser which can be deployed as a static site. That means you get a full fledged notebook and a kernel that can run any PyPi package that is pure python.
-
Stork Is Full Text Search for Static Websites
Stork Search is a full text search engine written in Rust that compiles to WebAssembly. That makes it compatible with static websites like notes.alexkehayias.com. The file size is relatively small (less than 1MB) for an index with hundreds of notes and the search results are fast.
-
Compress and Convert Images Using Webassembly
WebUtils is a browser-only way of converting images between various formats and compressing them using WebAssembly. Most services like this require a request to a backend server which you can’t inspect what’s going on. Doing all the processing client side is more private and (maybe) somewhat safer.