Firefox gets GPU Hardware Acceleration, JagerMonkey Boost

SpiderMonkey is the secret sauce that gave us the first browser that was leap ahead of IE. But, over the years competitors like Opera, Chrome, Safari had left Firefox far behind in performance.

Mozilla had started working on “JagerMonkey”, a new “baseline” method JIT compiler for SpiderMonkey, Firefox.The JagerMonkey method JIT will provide a much better performance baseline, and tracing will continue to speed up.

Right now, the work is pretty much in progress, JagerMonkey  is 18% faster interpreter and it’s a long way to go, the scope is huge.

Another amazing development is the DirectWrite & Direct2D landing in the nightly builds.

DirectWrite and Direct2D are Windows Vista and Windows 7 based DirectX 11 APIs for text and 2-D graphics that can be hardware accelerated. To test this feature, download the latest nightly build and do:

  • Enter ‘about:config’
  • Enter gfx.font in the ‘Filter’ box, Edit  ‘gfx.font_rendering.directwrite.enabled’ to set it to true
  • Below this, right click and select New > Integer to add a pref setting and Enter ‘mozilla.widget.render-mode’ for the preference name, 6 for the value
  • Restart

Known Issues: Some extensions like stylish and adblock+ may break the new features.The major benefit can be seen in  Rendering Heavy pages, and also the fonts look really great with DirectWrite enabled. Also, difference can be seen in 2d apps like Google Maps, very similar to what is coming in IE9.

So, if your GPU is sitting idle, it’s time to put it to good use.

JagerMonkey: Under the Hood

As David Madelin  claims on Mozilla blog, TraceMonkey’s tracing JIT is very fast, it is 9x faster at certain operations such as SunSpider’s “math-cordic” benchmark.

But it can’t really trace a benchmark like date-format-tofte, which calls eval in its main loop, so tracing only yields a 5% speedup on that program. David Anderson calls it “TraceMonkey has rocket boosters, so it runs really fast when the boosters are on, but the boosters can’t always be turned on”. There are many factors that can prevent the rockets from turning on, so there’s really no short description of the programs that don’t trace, but most of them fall into a few categories:

Programs with very branchy control flow.

Programs with many type combinations. Because TraceMonkey generates type-specialized code, it must generate a separate trace for every type combination (mapping of variables to types) the program generates. If there are 1000 type combinations, we have the same problems we get with 1000 paths.

In nutshell, type-specializing trace JIT generates really fast code, but can’t generate native code for certain situations. On the other hand, an optionally specializing method JIT generates moderately fast code, but can generate native code for any JavaScript program. When both of these are used collectively and intelligently, they can complement each-others drawbacks and produce extremely fast execution.

If all goes well, Firefox can compete with chrome’s current performance, but who knows how fast Opera and chrome would be by that time.

We write latest and greatest in Firefox, Chrome, Tech Guides, Apple, iPhone, Android, Open Source, Latest in Tech @taranfx on Twitter.

GD Star Rating
loading...
GD Star Rating
loading...

1 thought on “Firefox gets GPU Hardware Acceleration, JagerMonkey Boost”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.