WebAssembly could be the new binary file format for the Web

Jun 18, 2015 07:13 GMT  ·  By
WebAssmebly is a binary file format for the Web, supported by Apple, Mozilla, Microsoft, and Google
   WebAssmebly is a binary file format for the Web, supported by Apple, Mozilla, Microsoft, and Google

WebAssembly is a new project for delivering a binary file format for Web applications that can be run inside browsers at faster speeds compared to regular JavaScript files.

While there have been multiple previous efforts in speeding up Web applications, this project has something the others never had, and that's the backing of ALL browser vendors: Firefox through the Mozilla Foundation, Internet Explorer / Edge through Microsoft, Chrome and Safari through the WebKit team (mainly made up of Google and Apple engineers).

WebAssembly is currently only a discussion group on GitHub, where future possibilities for the new file format are being explored, but the W3C has already created a special page for the upcoming project on its website, so we can safely say even right now that it's on its way to becoming a Web standard.

WebAssembly was created to speed up JavaScript applications

According to the WebAssembly design guidelines, the new file format will allow developers to compile their "code" to a binary, which will then be executed inside each browser's JavaScript engine.

At the moment, only C and C++ code can be compiled into a WebAssembly (or wasm) file, and a polyfill exists for older browsers that will convert WebAssembly bytecode into plain JavaScript.

The advantage over raw-text JavaScript files is that WebAssembly bytecode has been shown from preliminary tests to be already 23 times faster than similar JavaScript applications optimized through Mozilla's asm.js, and 20-30% smaller when it comes to actual file size.

The project aims at providing the same set of features found in asm.js, a low-level subset of JavaScript that produces optimized JS code, and also improve its range to other programming languages, most likely to Microsoft's C#, Google's Go, and Mozilla's Rust.

The Emscripten LLVM-to-JavaScript compiler can be used to produce these binary files right now, but plans exist for other compilers, virtual machines, debuggers, and other types of programming-related tools to broaden WebAssembly's appeal.

It's not a JavaScript killer, it aims to work only in specific cases

Learning from the whole Dart debacle where everyone touted it to be a JavaScript replacement, which it eventually didn't become, the team behind this new project has stated pretty clear in the file format's design documents that WebAssembly is not meant to replace JavaScript, but be used for specific cases, working most of the times alongside it.

What this means is that no one is expected to use a WebAssembly binary file to power their drop-down menu, but use it instead for complex data visualizations, extremely large JS-driven Web or mobile applications, and Web-based animations.

"While WebAssembly will, over time, allow many languages to be compiled to the Web, JS has an incredible amount of momentum and will remain the single, privileged dynamic language of the Web," reads the official WebAssembly statement.