It is the beginning of 2017, and there's currently a Browser Preview phase going on for WebAssembly in Edge, Chrome and Firefox. While the tech isn't ready for the general public yet, it's excitingly close to release. See its MVP completion.

So WebAssembly, or wasm for short, is a technology that will soon be implemented by all major browsers, with the goal of significantly improving the situation of performance-sensitive applications on the web.

What kind of apps will it benefit? Any media-related app, Virtual Machines, 3D apps, etc.

WebAssembly vs Javascript

The main benefit that wasm have over Javascript is code-execution performance. Compared to Javascript, WebAssembly has..

  • Better memory management than what the GC can offer.
  • Efficient head loads/stores
  • No runtime type checks
  • Unboxed integer/float manipulation.
  • 64-bit operations

(what about startup time?)

WebAssembly vs asm.js

WebAssembly was developed to address certain concerns that came out of asm.js. Compared to asm.js, wasm offers the following:

  • Better startup time overall.
    • Delivery over the internet is a bit faster.
    • Decoding wasm's format is much faster than parsing asm.js.
  • A new standard.
    • asm.js being a subset of Javascript, it is therefore constrained by the Javascript specification.
    • As it is intented that asm.js serve as a polyfill to wasm, the two should remain compatible for the time being.
    • However, wasm shall lose this constraint in the future, effectively removing the Javascript specification as a limiting factor to wasm's evolution.

Additional notes

  • WebAssembly is a Stack machine specification. It is intended to be used as a compilation-target for LLVM-compatible languages, such as C/C++.

    • For example, this means that devs will be able to use codebases written in C/C++ on the web after compiling to wasm.

    • This also means that nobody would reasonably write a whole app in wasm by hand.

  • It adopts a binary format to enable fast decoding & small code-size compared to Javascript's text format.

  • WebAssembly code may be compiled Just-In-Time or Ahead-Of-Time.

  • JavaScript apps can offload to WebAssembly the execution of performance-sensitive tasks.

  • WebAssembly made a switch from AST to Stack Machine in Summer 2016.

People working on it

Developers from Google, Mozilla, Microsoft and Safari are working on wasm, but more notably..

  • NaCl devs (Google)
  • asm.js devs (Mozilla)