A short introduction to Webassembly

21 May 2021

Webassembly is a technology that enables highly performant code to run in almost any environment including the browser. The formal definition is as follows:

WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine.

However as someone who did not study electrical engineering, I am happy using the following image (taken from Lin Clark’s great series of cartoon articles on Webassembly) as a definition: image

I think of Webassembly as code that is as close to the metal as possible without making any assumptions on what the target actually is. This means that we have a very portable format that can quickly be compiled down to machine code.

You can find a curated list of languages that compile to wasm here.

Despite the fact that the Webassembly MVP spec has only been around for four years, there are already several interesting use cases, such as Google Earth, The AutoCAD Web App, Dropbox, and many more can be found here.

To learn more about how Webassembly came to be and how it compares to previous attempts to bring other languages than javascript to the browser I recommend this blog post by Steve Klabnik and this podcast with Brendan Eich.

There are also interesting ongoing projects that are trying to utilise Webassembly on the server such as Krustlet, Atmo and Wasmer.