A Brief Introduction to WebAssembly

Till now, JavaScript is the lingua franca for the web. But in future, this may not be the case, as some of the big players like Google, Microsoft, Mozilla, Apple and few other folks along with W3C have teamed up to create a new standard called WebAssembly which will be supported by all browsers.

What is WebAssembly?

The official website describe it as “WebAssembly or wasm is a new portable, size- and load-time efficient format suitable for compilation to the web.

In simple terms, WebAssembly is new binary format for web. It is a compile target for other languages to run on web.

Why WebAssembly?

JavaScript is robust and constantly improving. But, like any other languages, JavaScript is not perfect and is not suitable for all our needs. When it comes to moving to web, some apps and platforms are not easy to port with current standards. WebAssembly fills the gap where it would have been difficult with JavaScript.

For many years, many companies were trying to fix up the shortcoming of JavaScript in their own ways by extending it such as asm.js (Mozilla), typescript (Microsoft), NACL (Google). Now these projects and companies have come together to provide a solution called WebAssembly. With Emscripten, other languages can be compiled or transpiled to JavaScript but still JavaScript is the main target of these not VM. With WebAssembly, the need to transpile to JavaScript is removed but goes down low level of system equivalent to bytecode.

WebAssembly provides some benefits over JavaScript which are:

  • Write performance critical code using other language like c/c++.
  • WebAssembly can be natively decoded much faster than JavaScript can be parsed.
  • It loads significantly faster in mobile devices.
  • Sharing of code between applications.

What it means for web developers?

Web development is itself a challenging part where things are rapidly evolving and WebAssembly will be a new addition. With this we may see web used in lot of new application which is not possible in today’s scenario. WebAssembly will open more doors by freeing up from the shackles of today’s web. See a demo of angry bots demo ported to web using WebAssembly.

Is this the end of JavaScript?

*No! *While WebAssembly will allow more languages to be compiled to web, JavaScript is here to stay. In fact, JavaScript have enough inertia to drive the web for next decades. WebAssembly will boost JavaScript by complementing it, applications written in WebAssembly will also be able to integrate with JavaScript. The fact that JavaScript is giving enough competition to established back-end languages with Node.js, proves that JavaScript is still strong and will continue. Meanwhile it is best to stay with JavaScript and learn about it’s new features. JavaScript also have got new exciting features in the pipeline like pthreads, simd.

WebAssembly is still in its infancy. Only time could tell us how it will evolve. For some time being wasm and asm.js will stay equivalent to support
polyfilling of wasm via JS. After that wasm and JS may diverge. To bring new standard into the web will be as tough as exciting it sounds. But the upside is that we now have an open, vendor-neutral, cross-browser, experience based standard, commitment and involvement to major open source implementation on the

Some references to WebAssembly:

Bishal Timilsina

Read more posts by this author.

Subscribe to Bishal Timilsina

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!