Developer

Crazy Fast JavaScript Hits Firefox Nightly (With A Few Conditions)

JavaScript has become an inseparable component of the modern web and as such, browser vendors spend a lot of time optimising its execution. The ultimate goal is to get as close to native speeds as possible and while that’s quite the mountain to scale, Mozilla’s “OdinMonkey” optimisation module, now included in Firefox Nightly, gets darn close.

Luke Wagner of Mozilla announced the news on his blog, mentioning that OdinMonkey — essentially a wrapper for the company’s asm.js project — can speed up JavaScript to the point where it’s “within 2x of native performance”.

Unfortunately, there’s a catch. Existing JavaScript doesn’t benefit from the availability of OdinMonkey/asm.js. First, code needs to be cooked up in C/C++ (or other compatible language) and then pumped through Mozilla’s Emscripten compiler, which will generate compatible scripts. This JavaScript will benefit from the availability of asm.js, if the browser can provide it, otherwise, it’ll just run normally.

Explanations can only take you so far, the proof is always in the pudding — benchmark-flavoured pudding:

Images courtesy of Alon Zakai

The benchmarks show some impressive gains from asm.js-compatible JavaScript, often outperforming current implementations by staggering factors. These graphs are from a larger presentation by Mozilla engineer Alon Zakai, which you view here.

If you want to try it out, all you need to do is grab the latest x86/x64 Firefox Nightly build — either Linux or Windows — and hit up one of the following demos — BananaBench, or a physics demo powered by a Emscripten version of the Bullet engine.

Firefox Nightly Now Includes OdinMonkey, Brings JavaScript Closer To Running At Native Speeds [TechCrunch]


Have you subscribed to Lifehacker Australia's email newsletter? You can also follow us on Facebook, Twitter and YouTube.