Mar 23, 2011 11:00 GMT  ·  By

Firefox 4 is here for the world to enjoy. If you haven't seen the latest version of Mozilla's popular browser in action now is the time to do it. Likewise, if you haven't used it since the early beta stages, you'll notice a big improvement. One key focus for this release was on speed and this is seen in several aspects of the browser, from the UI, which is snappier, to the actual content.

"The web wants fast browsers. Cutting-edge HTML5 web pages play games, mash up and share maps, sound, and videos, show spreadsheets and presentations, and edit photos," Mozilla writes.

"Only a high-performance browser can do that. What the web wants, it’s our job to make, and we’ve been working hard to make Firefox 4 fast," it says.

"Firefox 4 comes with performance improvements in almost every area. The most dramatic improvements are in JavaScript and graphics, which are critical for modern HTML5 apps and games," it adds.

JägerMonkey - JavaScript on steroids

The latest upgrade to the Firefox JavaScript engine, JägerMonkey, is finally here. JägerMonkey provides just-in-time (JIT) compilation of JavaScript code in a wider number of scenarios ensuring that Firefox is fast all the time.

Compiled code is much faster than constantly interpreting JavaScript which is why it's used as much as possible. But the compilation process also slows things down, if it's not used wisely, it ends up doing more bad than good.

Continuing with the work laid out by TraceMonkey before it, JägerMonkey kicks in when TraceMonkey fails, providing JIT 'goodness,' albeit less optimized, all the time by compiling entire methods rather than snippets of code.

JägerMonkey uses several other means of improving performance, inline caching ensures that data is read as fast as possible, 64-bit values mean that memory is used more efficiently, and the CPU registers are used as much as possible to minimize the number of memory calls. You can read more detailed and technical descriptions in Mozilla's blog post.

The gist of it is, Firefox 4 is significantly faster than Firefox 3.6 and on par with any of the modern browsers, Chrome, IE9, Safari or Opera.

Hardware Acceleration

Another means through which Firefox 4 delivers huge performance is with hardware acceleration, offloading the graphics to the GPU rather than the CPU.

Not all hardware acceleration is created equal, so to speak, meaning that accelerated components and the subsequent performance boost varies from platform to platform, but all of them should see an improvement.

On Windows Vista and Windows 7, Firefox 4 is on par with Internet Explorer 9, content is accelerated using the Direct 2D API and the final page composition is done via Direct 3D.

On Windows XP, which is not supported by Internet Explorer 9, only the composition is accelerated since there is no Direct 2D API.

On Linux and Mac, web content is accelerated via XRender and the Quartz library respectively. Composition is handled by OpenGL in both cases. HTML5 video is accelerated on all platforms via Direct3D or OpenGL.

Since Firefox 4 also supports the nascent WebGL standard, web apps can leverage the GPU for great 3D graphics inside the browser.

Note that any hardware acceleration performance benefit becomes moot if you're not running a recent version of your graphic card drivers. Mozilla maintains a list of cards and drivers supported. If your card is not on the list, no hardware acceleration is enabled.