Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Wonderful WebAssembly

Wonderful WebAssembly

WebAssembly is neither "web" nor "assembly" - but 100% amazing. It is our one chance to build a fast, safe, and universal compilation target for all languages and all platforms.

Let me show you why this is cool and how to get started with WebAssembly in Go, C, and Rust.

We will also learn about up and coming features of WebAssembly (like WASI) that will make it even faster and more versatile. Let's change the way we write software forever!

Matthias Endler

November 07, 2019
Tweet

More Decks by Matthias Endler

Other Decks in Programming

Transcript

  1. Matthias Endler ...works at trivago ...mostly Backend ...afraid of Frontend

    ...Python/Golang/Rust ...Runs "Hello Rust" https://endler.dev
  2. " UNIX is very simple.
 It just takes a genius


    to understand its simplicity. " -- Dennis Ritchie
  3. function Vb(d) { d = d | 0; var e

    = 0, f = 0, h = 0, j = 0, k = 0, l = 0, m = 0, n = 0, o = 0, p = 0, q = 0, r = 0, s = 0; e = i; i = i + 12 | 0; f = e | 0; [l + 4 >> 2] = 0; l = (c[1384465] | 0) + 3 | 0; do { if (l >>> 0 < 26) { if ((c[1356579] | 0) > 0) { m = d + 4 | 0; n = 0; while (1) { o = c[(c[1356577] | 0) + (n << 2) >> 2] | 0; do { if (a[o + 22 | 0] << 24 >> 24 == 24) { if (!(Vp(d, o | 0) | 0)) { break } p = (c[m >> 2] | 0) + (((c[h >> 2] | 0) - 1 | 0) * 40 & -1) + 12 | 0; q = o + 28 | 0; c[p >> 2] = c[q >> 2] | 0; c[p + 4 >> 2] = c[q + 4 >> 2] | 0; c[p + 8 >> 2] = c[q + 8 >> 2] | 0; c[p + 12 >> 2] = c[q + 12 >> 2] | 0; c[p + 16 >> 2] = c[q + 16 >> 2] | 0; asm.js
  4. 5 3

  5. (func (param $foo i32) (param $bar f32) (local $baz f64)

    get_local $foo get_local $bar get_local $baz )
  6. (module ( func (param $a i32) (param $b i32) (result

    i32) get_local $a get_local $b i32.add ) )
  7. (module (func $add (param $a i32) (param $b i32) (result

    i32) get_local $a get_local $b i32.add) (export "add" (func $add)) )
  8. (module (type $type0 (func (result i32))) (table 0 anyfunc) (memory

    1) (export "memory" memory) (export "hello" $func0) (func $func0 (result i32) i32.const 16 ) (data (i32.const 16) "Hello World\00" ) )
  9. 0 750 1500 2250 3000 Go C Rust How big

    is " Hello World " (in KB)? 40k 1k
  10. 0 750 1500 2250 3000 Go C Rust "Hello World"

    unoptimized (KB) 20k 400 bytes