Contribute Media
A thank you to everyone who makes this possible: Read More

Getting the hang of WASM

Description

Web Assembly (WASM) is a new open standard developed by representatives from all major browsers. It is a low level binary format designed to be compact and run at native speed, while being memory-safe.

WASM is primarily intended to run code in browsers, but will also run in other environments like desktop, mobile and more. This makes it interesting to use as an intermediate language (IR); code that compiles to WASM will (in the future) run basically anywhere.

A proof of concept was released early this year and works out of the box in recent Firefox and Chrome browsers. In order to play with WASM myself, I wrote a tiny Python library that makes it relatively easy to generate WASM modules.

In this talk I will briefly explain what WASM is, describe the anatomy of a WASM module, how it fits in the host environment (e.g. JavaScript or a C++ program), and the kinds of opportunities that this provides. Via live coding in a notebook, I will first write a simple WASM program by hand, compile it to binary WASM, and execute it in the notebook itself. We will then move to higher levels (including a Mindfuck to WASM compiler) and end with compiling a simple Python program to WASM, which will find the 10001st prime much faster than Python does. As a side effect, this talk is also a crash course on how compilers work.

I expect WASM to have a major impact. Although it is currently in its early infancy, we can already play with it, and I hope to give a glimpse of the awesome things that it can do.

Details

Improve this page