Does TraceMonkey kick Firefox into turbo mode?

Does TraceMonkey kick Firefox into turbo mode?

Summary: Over the past few days I've been hearing a lot about Mozilla's new and improved JavaScript engine codenamed TraceMonkey. This new scripting engine hopes to bring JavaScript up to speed with natively-compiled code rather than be stuck in the slow lane like other interpreted coding languages. But does it work?


Over the past few days I've been hearing a lot about Mozilla's new and improved JavaScript engine codenamed TraceMonkey. This new scripting engine hopes to bring JavaScript up to speed with natively-compiled code rather than be stuck in the slow lane like other interpreted coding languages. But does it work?

I'd have taken a closer look at TraceMonkey last week but a sudden bout of stomach flu put me in a mood to do very little other than to sit down quietly and take small sips of water. This morning though I awoke feeling a lot better and decided to take a look at TraceMonkey for myself.

To use TraceMonkey I first had to download a nightly build of Firefox 3.1 (the build I'm using here is dated Aug 25). To switch TraceMonkey on I had to open an about:config tab and set javascript.options.jit.content to true.

So, with the nightly build downloaded and installed I then went on to replicate two out of the four tests that Mozilla team members had already posted data for, which were:

Note: I didn't run the Matrix manipulation test because I couldn't figure out how to make it work and it'll become clear in a moment why I didn't run the SunSpider ubench test.

Tests involved making two runs - one with TraceMonkey disabled and another with it enabled.

Test 1 - SunSpider JavaScript benchmark

  • TraceMonkey disabled: 2781.0ms +/- 5.0%
  • TraceMonkey enabled: Test failed

Does TraceMonkey kick Firefox into turbo mode?

I'm not sure what was going on here but the date-format-tofte script seemed to crash the browser every time when TraceMonkey was enabled. Based on this issue I abandoned my plans to run SunSpider ubench too.

Test 2 - Image manipulation demo

I had more luck with the image manipulation demo.

  • TraceMonkey disabled: Draw Time: 430ms | Frames Per Sec: 2.3255813953488373
  • TraceMonkey enabled: 89ms | Frames Per Sec: 11.235955056179774

That makes TraceMonkey around 4.8 times faster than the standard JavaScript engine.

Real world testing

In addition to running benchmarks, I tested TraceMonkey out on a selection of websites that I regularly visit and found there to be a huge performance boost to be gained from TraceMonkey. Websites such as Gmail were amazingly responsive, much faster than what I normally expect from them even when using Firefox 3.0.

However, I did experience a few crashes while surfing so this technology is still a way off being ready for prime time. But it does offer the promise of a much faster, smoother internet experience.

Good work Mozilla team!

Topics: Software Development, Browser, Open Source

Kick off your day with ZDNet's daily email newsletter. It's the freshest tech news and opinion, served hot. Get it.


Log in or register to join the discussion
  • Wow, we are breaking down the barriers to web application adoption for all

    of our every day applications. The speed here will be so close to natively compiled code that it will not matter any more.

    But, we still need some kind of a sandboxed VM so companies can push pre-compiled byte codes down do do things like file conversions locally when offline. I guess if JavaScript is this fast, then you could use it for importing an MS Office format file locally for instance, but, not everybody will want to make their code public or re-write it in JavaScript.

    But, as FireFox is available on ALL platforms, we could see sites requiring FireFox for advanced features before long.
    • You say that as if that would be a good thing

      I would rather see sites comply to standards and be given a choice as to which OS and browser to use.
      Michael Kelly
      • But, Microsoft would love to hold back the browser. Microsoft wants you to

        have to use Microsoft only technology to get rich interactive web applications. They do NOT want to see the browser improve.
  • Standards Based Rich Client Applications

    Really opens up the door for truely interoperable standards based rich client applications. No need to be locked into a single commercial vendor like Adobe Flash/Flex or MS Silverlight. Should really see a re-surgence in AJAX based Javascript applications. Safari based on SquirrelFish is also excellent in this regard. IE has really been left in the dust by the Safari/Firefox competition (like Intel/AMD competition left all other processors in their dust). Will be especially nice once derivatives of Firefox and Safari make it to all mobile devices, so we don't need to worry about things like the brain-dead browser on the Blackberry.
    • The days are numbered that MS can stall browser innovation, but MS is

      still dragging their feet on about everything to slow down innovation. They do not want the standard browser to get very good, otherwise, people will have even less incentive to use MS only technologies.
      • Personally

        I'm more interested in browser security than the speed of a JavaScript page. While nice I'd always take security over speed. And from the looks of it IE8 is going to be far ahead of both Safari and Firefox in that department. Also, MS is stuck using Sun's Java engine. Remember what happened when they made their own? That's right, they had to pull it from Windows.
        • Suns Java engine?

          What does that have to do with this article. Javascript is not Java and does not use the JVM. And when talking about MS the last thing I'd talk about is being locked into some technology.
        • Browser security is important but probably not the way you think

          The economics of malware are such that by and large malware authors go for instrumenting your machine... they largely don't give a rat's a** about the cookies to any domain you visit. While yes cross site scripting is bad, they would put keyboard loggers on 100 machines vs. steal 100 sets of cookies. Cookies can be ephemeral and if a bank has designed their site right, which most do, they're useless in a short period of time. Juxtapose that with the situation of having a keyboard logger installed in your machine such that someone can see and log everything you type, e.g.


          Who cares about cookies if you've now got the keys to the kingdom (your bank account) and now can someone pose as you and readily log on.

          The biggest problem (Vista being the exception) is that 99% of people run their browsers with administrative privileges. So your browser through subterfuge (usually JavaScript) instruments your machine because your browser runs with administrative rights and a process with administrative rights is free to write anywhere in your file system, i.e. modify and/or add to operating system directories.

          Increasingly hackers are breaching or leveraging a legitimate site to instrument your machine, aka pharming, this is a good example:

          If you go to which talks about the hack more specifically you see that what they do is modify JavaScript that is served up by adding a reference to an outside site (this is an example):

          < script src=? w.js? >

          So the site you've always enjoyed going to, suddenly serves you JavaScript with this extra statement and your browser dutifully pulls in malware from another server that has absolutely nothing to do with the site you're visiting.

          What the rogue JavaScript will do depends on the authors. Indeed they made decide to do *OTHER* things outside of stealing cookies but overwhelmingly these guys go for machine instrumentation (keyboard loggers).

          And because many, Many, MANY people are still on Windows XP (and because 99% of them run with administrative rights), they get screwed.

          Vista like Mac OS X has users running without administrative rights and this more than anything right now is the greatest defense from having your system compromised. At least if the site you visit patches or catches the SQL injection attack I pointed out earlier, the length of time of exposure is limited. Bad for you potentially, but without admin privileges you can rest comfortably your machine hasn't been instrumented.

          When most people are on Vista and/or "Son of Vista" (whatever it's called) then hackers will have to be far more clever and work much harder to derive monetary benefit, but for now, it's all "easy money" for them given how many people will be on Windows XP for quite some time. More so when reports say 30% of Vista users downgrade to XP.

          Anyway, if you're such a person, you should seriously consider using RemoveAdmin:

          It will also work on Vista if you've foolishly turned off UAC.

          If you look at the shortcuts created by the RemoveAdmin installer you'll see it's really a general tool and can be used to strip administrative rights off any application that is launched... which means you should use it with anything that talks on the Net.

  • RE: Does TraceMonkey kick Firefox into turbo mode?

    can't wait for that Monkey. IE is going to be drop as a browser faster than before.
  • Will they finally make Javascript multithreaded?

    It's 21st century already FGS.
    • The JavaScript for Gears is multi-threaded, but, this is LONG overdue.

  • We'll see a lot of new security flaws in Firefox...

    We'll see a lot of new security flaws in Firefox... Stay tuned!
    • New code does bring along the risk that there will be security problems,

      but, if you are replacing an old code base that was not well written, or was added on to many times, sometimes you can improve security, at least in the long run.

      With your attitude, we would still be running Windows 3.1.
  • Thanks are owed to open-source developers

    We don't give enough credit and thanks to the men and women who do open-source development and testing. A few do as part of their paid jobs, but many more do it for free on their own time, and they deserve a lot of credit. My company runs almost a thousand servers using a free operating system, free database, free scripting engine and free webserver. I'm typing in this message using a free no-strings-attached browser. If you know someone involved in the open-source effort, take a few seconds to pat them on the back and say thanks.
    terry flores
    • Now if everybody else had an understanding like this...

      ...we'd all be better off.
    • Absolutely!

      Agree 100%
      Adrian Kingsley-Hughes
  • Adrian, can you perform this benchmarking again,

    perhaps with some additional, real world comparisons, when [b]FF 3.1[/b], presumably with [b]Trace Monkey[/b] installed and enabled by default, is released ? It will certainly be interesting to compare the new figures with the pre-[b]Trace Monkey[/b] ones....


    PS : Couldn't agree more with terry flores' posting above....
    • I would ...

      ... but the last nightly build of FF3.1 I downloaded broke SunSpider!

      I try it again later this week.
      Adrian Kingsley-Hughes