Original URL: http://www.theregister.co.uk/2010/09/09/firefox_4_jagermonkey_previews/

Firefox 4 preview knocks back Jäger shot

Buzzed browser races rivals for JavaScript crown

By Cade Metz

Posted in Applications, 9th September 2010 23:09 GMT

Mozilla has released preview builds of Firefox 4 that include JägerMonkey, the new JavaScript engine extension designed to outpace rival engines from the likes of Google and Opera.

According to the open source outfit's latest SunSpider JavaScript benchmarks, JägerMonkeyed Firefox still trails all major competitors, but on the V8 benchmark, it has surpassed Microsoft's Internet Explorer 9 preview, and on both test suites, it's steadily gaining ground.

With Firefox 3.5, Mozilla juiced JavaScript performance with a compiler known as TraceMonkey, but not all JavaScript code is suited to Mozilla's "tracing" technique, which works to convert code loops into speedy assembly language. JägerMonkey aims to boost performance when tracing doesn't apply.

JägerMonkey is a method JIT compiler based on the Nitro assembler built for Apple’s open-source WebKit project, the same assembler used by the Google Chrome and Apple Safari browsers. TraceMonkey will continue to convert code loops into assembly code, but when this isn't possible, JägerMonkey will kick in, converting entire methods to assembly code.

Jagermonkey diagram

JägerMonkey borrows the Nitro assembler from WebKit

"While the technology inside TraceMonkey makes it faster than any other engine on certain programs (then and now), it doesn’t help other programs as much. And the web has grown more complex, with more and more JavaScript-intensive demos, apps, and games," reads a blog post from Mozilla man David Mandelin announcing the release of the JägerMonkey preview builds. "And the competition has been getting a lot tougher, with engines that could run fast on bigger and prettier web apps. We knew we needed another major upgrade for Firefox 4.0, to make us fast all around."

Mandelin says the project involved revamping the fundamental value type of Firefox's Javascript engine, which meant updating roughly 20,000 lines of code. He compares this to a "vascular system transplant." The new "whole-method" JIT compiler required about 23,000 lines of code, and it supports x86, x86-64, and ARM with an "almost entirely shared" compiler code base.

Mozilla director of web platform Chris Blizzard has said that Firefox 4's JavaScript performance will be "one generation" ahead of its rivals. But at least for the moment, Mandelin plays down benchmark numbers. "Those aren’t the main goal, but they are a really convenient target for us to aim at," he says. He adds that the new JavaScript engine will be "a little bit faster yet" by the time Firefox 4 officially arrives this fall.

The JägerMonkey preview builds are available for Linux, Windows, and Mac, including 64-bit Linux and 64-bit Mac. ®