2016-04-05

Sebastian Anthony

Mozilla has just rolled out OdinMonkey, a new module for Firefox’s JavaScript engine that promises to speed up JavaScript execution beyond your wildest dreams. If you were drawn to Chrome because of its superior JavaScript performance, or to Internet Explorer because of its neat separate-process Chakra JavaScript engine, OdinMonkey — which can boost JavaScript performance by 1000% or more — will put you firmly back in the Firefox camp.
OdinMonkey is a module for Firefox’s IonMonkey JS engine that optimizes the execution of asm.js. In short, asm.js takes specially-crafted JavaScript code, compiles it to native assembly language, and executes it. With OdinMonkey optimizing this process, code executed this way is only two times slower than native execution (as if the code was executed locally, outside the browser, without the JS-to-assembly transcompiling). While this might not sound particularly fast, normal JavaScript (such as when you load the ExtremeTech website) is maybe 20 or 30 times slower than native code. For comparison, Chrome executes asm.js code at around 10 times slower than native speed, and Firefox (without OdinMonkey) is around 12 times slower than native.
Barely a day goes by without a headline announcing the arrival of an exciting new feature in Chrome, Firefox, Safari, or their mobile variants. For the most part, despite the headlines that tech sites use, these features aren’t actually all that exciting. OdinMonkey, however, really is a big deal: Not only does it boost performance by a huge margin, but it could also act as a cornerstone for web apps that actually perform like their installed, native cousins. In short, OdinMonkey could finally allow for a web-based Adobe Photoshop or Crysis.

OdinMonkey/Asm.js performance, vs. natively executed code

More importantly, though, asm.js offers an alternative to Google’s Native Client — a module for Chrome and Chrome OS that allows the browser to execute native C and C++ code. (See: What is Native Client?) While the implementation of Native Client is just fine, the problem is that it draws developers away from cross-platform open web technologies, such as HTML5, CSS, and JavaScript. Mozilla has always been leery of Google’s Native Client intentions, especially when Big G spends so much time extolling the virtues of open web technologies. OdinMonkey and asm.js essentially offer a high-performance alternative that retains the flexibility and platform agnosticism offered by open web technologies. (See: Firefox OS doesn’t stand a chance.)
OdinMonkey landed in Firefox Nightly yesterday, which means it should arrive in the stable build of Firefox 22 in June, assuming no blocking bugs are encountered. If you want to try out OdinMonkey and asm.js, you’re probably out of luck for now. For now, OdinMonkey is designed to handle code that has been created with Emscripten — a relatively new project that’s also developed by a Mozillan. As always, while a new technology might sound awesome, it takes a lot of time and effort for it to cross the chasm from theory and into reality. Still, Firefox and Mozilla are a force to be reckoned with, and no one ever complains about faster JavaScript performance — so here’s hoping that OdinMonkey makes a splash, and that dynamic websites are soon 20 or 30 times faster.

Show more