Microsoft Subnet An independent Microsoft community View more

Meet WebAssembly: Microsoft, Google, and Firefox's alternative to JavaScript

The giants team to create a new binary web format for making complex web apps.

JavaScript code
Credit: Dmitry Baranovskiy

It's rare to see Google and Microsoft work together on much, so you know there must be something special behind WebAssembly, a new binary format for compiling applications for the web.

WebAssembly is designed to address the shortcomings of JavaScript, which is the closest thing to a standard language for building web- and browser-based apps. The problem is that JavaScript is a text language that has to be parsed and executed by interpretation, which often makes the apps slow as they get complex.

The idea behind WebAssembly is to provide developers with a single language target for web apps that will hopefully become a web standard. With Google, Microsoft, Firefox, and the team behind the WebKit browser (which is used in Apple's Safari), there's a good chance of that happening.

There have been attempts to speed up JavaScript, most notable asm.js, which allowed software to be written in languages like C but be run like a JavaScript web application at faster a speed. However, WebAssembly is promising performance improvements of up to 20 times faster than asm.js.

The new format has a .wasm file extension, and its code is compiled into a binary, where it is then executed inside the JavaScript engine. Brenden Eich, the creator of JavaScript and the short-lived Mozilla CEO, noted on his blog that developers will be able to use the same Emscripten tool for building WebAssembly apps that they currently use for compiling asm.js code.

Eich said he expects .wasm and JavaScript to diverge, with .wasm taking on more complex application duties. JavaScript is sandboxed to keep it from having too much access – it can be blocked from accessing your hard drive for security reasons.

In the short term, the group working on WebAssembly plans to launch a polyfill library that will translate WebAssembly code into JavaScript. Eventually, browsers will ship with native .wasm support and this will not be needed.

For now, .wasm apps are written in C/C++. As the project matures, the team expects to see more compilers and debuggers from other languages. That's the point of the project, the team points out in its FAQ – to allow an array of languages to be turned into compiled code for the web and not just be locked into JavaScript.

All of the information, including code, can be found on the GitHub site.

Join the Network World communities on Facebook and LinkedIn to comment on topics that are top of mind.
Must read: 10 new UI features coming to Windows 10