Unleash the power of JavaScript with Mozilla TraceMonkey

by Raju Bitter on March 12, 2009

In February Mozilla has taken a huge step into a more feature-rich JavaScript RIA world: Firefox 3.1 and future versions contain the new TraceMonkey just-in-time JavaScript compiler. But before we go into technical details, let’s listen to what Mark Beltzner, the Mozilla Phenomenologist has to say about the Mozilla mission in an interview with BetaNews:

“The entire mission of the Mozilla Corporation is to promote innovation and choice and development of modern Web applications, and we’ve got these fundamental beliefs that a Web application can be as interactive and as immersive and as functional as any desktop application.”

Agreed, absolutely, and Mark continues:

“So what we believe is, the same sorts of things that you can accomplish with the AIR platform or Silverlight, or any of these rich Internet applications platforms, you can also do with standard Web technologies: SVG, Canvas, JavaScript, DOM, HTML.”

Tracing the Monkey?
TraceMonkey adds native‐code compilation to Mozilla’s JavaScript engine (known as “SpiderMonkey”). It is based on a technique developed at UC Irvine called “trace trees”, and building on code and ideas shared with the Tamarin Tracing project. The net result is a massive speed increase both in the browser chrome and Web‐page content.

If you would have asked me 2-3 years ago, I would have never believed that the browser’s JavaScript engines will be powerful enough to replace technologies like AIR or Silverlight at some point, but the work of the Webkit and Mozilla/Firefox team have taught me a lesson. When OpenLaszlo came out with the proof-of-concept for a DHTML runtime in March 2006, showing the LZPix app running in both Flash and DHTML mode, I was stunned. Remembering my first experiences with coding DHTML apps around 2000, fighting with different browsers, terrible performance I was happy to get away from what I considered an unstable and immature language and technology: JavaScript.

A bit after the DHTML announcement Henry Minsky of the OpenLaszlo team did his great OpenLaszlo SVG kernel hack, just a simple example showing that it’s technically possible to extend OpenLaszlo to SVG. I’m a big fan of SVG, and initially thought that – at some point – it might be serious competition for other vector based technologies like Adobe Flash for example.

In 2007/2008 for the first time I saw that a browser’s JavaScript engine could deliver superior animation performance to Flash8/SWF8. David Temkin pointed me to Max Carlson OpenLaszlo physics demo, which runs in SWF7, SWF9 and DHTML mode. Back then I tested with the Webkit Nightly Builds, which seemed to have the best JavaScript performance of all browsers around.

Firefox now – with TraceMonkey turned on – feels even more responsive than Safari, and I personally prefer Firefox as a browser. IE7 is a lame browser compared to both Firefox and Webkit/Safari, and I keep wondering why so many companies stick with the IE in the first place.

The speed of TraceMonkey
Brendan Eich has detailed information in his blog about the speed improvement TraceMonkey brings to JavaScript execution in Firefox. David Mandelin has a blog post with a good explanation and visualization of the performance improvement Firefox gets with TraceMonkey. While the excitement around XUL – the Mozilla RIA language – seemed to have cooled down a bit in the last 2 years, the performance boost we see with the latest versions of Firefox 3.1 or 3.2 will definitely fire interest in Mozilla/Firefox technology as a powerful RIA platform.

In my last blog post I said that Flash will be strongest RIA platform in 2009, but the advance in JavaScript engines gives me hope that 2010 might be turn-around year in favor of open standards based RIA applications, utilizing a stable TraceMonkey engine. Firefox will be THE browser to give proof to the fact that we can build large and powerful RIAs running purely in JavaScript engines, utilizing open standards like SVG and the browser canvas.

I personally thank everyone working on the various Mozilla projects and the Firefox browser for their great work. Firefox is probably the most used open source software I have installed on my machine, and I just get so used to having it for free that I sometimes forget how much hard work goes into the software. And I couldn’t agree more with Damon Sicore, Director of Engineering at Mozilla when he says:

“I think the thing to keep in mind there, and what’s absolutely critical, is, whatever we do to build those [future RIA] applications, no matter how complicated they are, they have to be based on open standards to allow innovation by the common man — not locked into a proprietary technology to build these exciting, brand new, far-fetched applications.”

Share:
  • Print this article!
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • E-mail this story to a friend!
  • Ping.fm
  • Twitter

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post: Adobe Flash strongest RIA platform in 2009

Next post: Mozilla pre-releases Firefox 3.1 beta 3 – happy testing