Microsoft’s JavaScript Engine Will Soon Support Mozilla’s Asm.js

Next Story

Google’s 2015 Science Fair Opens For Submissions Today

Over the last few years, Mozilla has developed asm.js, a subset of JavaScript that can be executed fast. Until now, asm.js optimization was only available in Firefox. But soon this technology will also be available in Microsoft’s Chakra JavaScript engine in the upcoming Windows 10.

As the company today announced, asm.js support has long been one of the top 10 most-requested features from developers, and the Chakra team has decided to implement it. That’s a huge vote of confidence for asm.js and it’ll likely mean that far more developers will now take a closer look at this technology.

“Over the last few months we’ve taken a close look at asm.js as a technology, related technologies, and what they entail for the Web at large. While challenging to write by hand, asm.js is leveraged principally by transpiling C/C++ code to run on the Web platform, utilizing technologies such as WebGL and Web Audio,” the Chakra team writes today.  “Asm.js is a clear step towards enabling near-native performance for the Web platform, which is why we’re excited to bring it to Chakra in an upcoming release.”

The main idea behind asm.js is that developers will compile their C/C++ code into this optimized subset of the JavaScript language (using the Emscripten compiler) that the browser can then execute. Developers could, of course, also write their own asm.js-compatible code, but that’s necessarily the focus of the project. In its current form, asm.js code runs about 1.5x slower than the same C/C++ code.

This makes it significantly easier to port mobile and desktop games (where the code base for the original desktop or mobile game was likely written in C anyway) to the browser. Without asm.js, you’d likely see quite a bit of stuttering in these games. Because the code is still completely standard JavaScript, it will also still run on in any other browser — just not as fast.

BenchmarkGraph_windows

Featured Image: Flickr UNDER A CC BY-SA 2.0 LICENSE