Firefox 3.1 Gets Major JavaScript Speed Boost

The new TraceMonkey Just-In-Time compiler brings notable improvements

  TraceMonkey JIT Compiler Released
The latest Firefox 3.1 nightly-built comes with a new JIT compiler for SpiderMonkey, Gecko's JavaScript engine. The compiler is part of a project called TraceMonkey, which aims at bringing significant improvements in JavaScript performance. The tests so far show major speed boost in JavaScript functions.

TraceMonkey is based on a technique called Trace Trees which in essence determines and compiles the most often used code. The technique was developed at the Irvine University of California (UCI) and was implemented in collaboration with the Tamarin Virtual Machine project. This is set to bring a new level of JavaScript performance "where instead of competing against other interpreters, we start to compete against native code", notes Mike Shaver, Interim VP of Engineering at Mozilla.

A test performed with Apple's SunSpider JavaScript Benchmarking tool shows a 1.8x performance increase for Firefox 3.1 with TraceMonkey over Firefox 3 and the SunSpider ubench test shows a whooping 22.5x performance increase. In comparison, Firefox 3 brings an overall 0.2x (20%) performance improvement over Firefox 2. Other tests like an image manipulation demo and Sylvester 3D-based matrix multiplications reveal a factor of over 6x performance increase.

Brendan Eich, Mozilla Chief Technology Officer, considers that the overall improvement score of 2x is an appropriate estimation for the current implementation, but he's certain this will further improve. "But this is only a start. With tracing, performance will keep going up. We have easy small linear speedup tasks remaining (better register allocation, spill reduction around built-in calls). We will trace string and regular expression code and break through the '2' barrier. We will even trace into DOM methods," he notes and Mike Shaver shares this opinion: "There are many wins left in each one of those benchmarks, and we'll be working on those through Firefox 3.1 and beyond: better code generation, more efficient guards, improvements to some data structures, parallel compilation, use of specific processor features, new optimization passes, tracing more code patterns, and many more".

Developers should note that TraceMonkey, while present in the latest nightly built of Firefox 3.1, is turned OFF by default. For testing purposes, an image manipulation demo page set up by Mike Schroepfer can be used; the corresponding screencast can be watched instead. More tech savvy users that are interested in the tracing technology can read the original Trace Trees paper or the the Hotpath paper.


By    25 Aug 2008, 11:18 GMT