You would have to try hard to avoid hearing about WebAssembly/WASM. Hardly a day goes by without another article popping up.
Some years ago we used emscripten to turn a C/C++ game engine into JavaScript/WebGL for running in a web browser. Amusing, but the resulting mess was big, slow, and pretty painful to debug. Unity dialed this to 11: C# -> (via Mono) IL -> (via IL2CPP) C++ -> (via emscripten) JavaScript
. They deserve a tip o’ the hat for that impressive bit of software engineering gymnastics, but I’m glad I never had to use it.
I’ve been curious about the tech behind WASM, but not being a web-frontend guy was only casually/passively interested. WASI changes that by embracing WASM outside the browser; another contender for the “write once, run anywhere” panacea.
The Rust Connection. Namely, why Rust? The Rust team made WASM a focus for 2018 because reasons. The crux of the argument being:
- Languages without runtimes are the best candidates for WASM (i.e. C/C++/Rust)
- Rust is better/safer/easier (especially for people coming from JavaScript) than C/C++
Perhaps subjective, but palatable with the right colored glasses (unless you’re a diehard C/C++ enthusiast). Are Rust and WASM the solution to all your problems? Probably not, but we can be interested in the tech regardless.
Rather than write a verbose treatise on WASM basics (of which there are many), thought I’d round up various resources and notes/browser tabs I’ve got hanging around.
Introduction to WASM:
WASI- WASM outside the browser:
Use cases:
- Serverless:
- Embedding:
- Others
Digging in:
- Rust WASM working group and docs.
- Runtimes: wasmtime, Lucet, and wasmer (all built with cranelift). cervus Linux user-mode.
- js-sys: Rust bindings to JavaScript ECMAScript standard.
- web-sys: Rust bindings to browser APIs. Auto-generated from WebIDL.
- Performance:
- Internals:
- Multithreading Rust and Wasm
- Memory in WebAssembly (and why it’s safer than you think). Just check out the Mozilla blog there’s other interesting stuff there, no need to individually link it all.
Misc:
Top comments (2)
Have you also already looked at wasmer.io/ ? 🙂 Looks like a good approach to distribute wasm applications.
Only briefly, been more focused on wasmtime so far.