Sunday, August 31, 2008

TraceMonkey will drasticly increase speed of Javascript in FF3.1

Firefox 3.1 will be the next major Firefox release. There is still no release date known, but it will probably be end of 2008, start of 2009. The last official (development) release is Alpha 2 released on 19 August. The developers are still hard busy with working and a lot has already changed between then and now.

TraceMonkey is one of those things. It started as an adaption to the JavaScript Engine to increase the speed of JavaScript and has now landed in the nightly releases. Still not enabled by default cause of some regressions, but if you want you can enable it yourself and see what the speed improvements really are.

Step 1: Download the latest release
Step 2: Type 'about:config' in the urlbar
Step 3: Search for javascript.options.jit.content
Step 4: Enable it

It is still buggy, so webpages that use advanced javascript will probably break (ex. google docs)

You could now ask why the speed of JavaScript is so important. First you need to know that FireFox uses his own technologie of Javascript to render the layout of his browser. So actually almost every button is made out of Javascript and CSS. So if JavaScript get faster, the browser gets faster to. To let TraceMonkey increase the speed of Javascript in the browser to, you need to enable another thing:

Step 1: Type 'about:config' in the urlbar
Step 2: Search for javascript.options.jit.chrome
Step 3: Enable it

Now Firefox itself will be responsiver and faster. (Also still buggy)

But sites can also use this boost. It makes existing websites faster and opens a way to more complicated and advanced sites, without having to worry about the performance.

To see some numbers about the speed up, I would recommer you to read: Brendan's blog
More information about the used technology: trace trees (PDF)