Firefox 9 JavaScript performance will be improved by 20-30%

Share This article

After more than 18 months of hard graft, Mozilla has finally succeeded in landing a big addition to Firefox’s JavaScript engine that, upon initial testing, speeds up the web — or at least the vast swaths of it that use JavaScript — by around 20 to 30%. The new feature is the introduction of type inference to Firefox’s JaegerMonkey JIT compiler, and it will debut with Firefox 9. It was originally meant to land a few months ago, in time for Firefox 5, but it took until now to reach a stage where it’s almost ready for primetime.

If you’re a web programmer, your mind will have been summarily blown. If you’re less technically minded, however, here’s a basic description of type inference and why it will speed up Firefox’s JavaScript performance by such a large margin. In every programming language, variables and functions have types. A type can be an integer, a string, a float (decimal number), an array, a class — and so on. These are internal constructs that are incredibly important to a programming language compiler or interpreter.

Some languages are strongly typed, which means that the programmer must define the type of every class, function, and variable that he uses; tiresome, but it can have big pay-offs in terms of overall speed. Other languages, like JavaScript, are weakly typed, which means that the programmer doesn’t have to worry about such piffling minutiae; you can just write some code and let the compiler do the heavy lifting. Type inference fills in the gap between strong and weak typing so that you can still write sloppy code, but reap some of the speed boost.

In the case of Firefox 9, the type inference engine seems to produce up to 30% faster JavaScript execution. It varies from benchmark to benchmark, but the performance improvement is unmistakable. The ExtremeTech benchmark rig is an Intel i7 930 @ 3.8GHz with 6GB of RAM and an Nvidia GTX 460, and these are the figures we obtained: With Firefox 9, and without type inference, the Kraken benchmark takes 3895 milliseconds; with type inference enabled it takes just 2763 milliseconds. Firefox 9, without type inference, scores 6075 on the V8 JavaScript Benchmark; with type inference, the score jumps up to 6585. Even on banal tests like Microsoft’s HTML5 Sudoku, type inference improves the solving time for 10,000 grids from 2.6 down to 1.62 seconds — and yes, the FishBowl framerate, at 2,000 fish, is increased by 15-20% with type inference enabled.

In case you were wondering, the JavaScript engine in Firefox 6 (the current stable build that you are probably using) is basically the same as Firefox 9 — but without type inference. In other words, Firefox 9 will be around 30% faster than your current browser.

Finally, before you run out and install the latest Firefox 9 nightly, bear in mind that type inference in its pre-release form can also cause some scripts to slow down — and if you’re using a 64-bit build because it’s meant to be faster, bad news: the 32-bit build with type inference certainly seems to be faster at the moment. By the time Firefox 9 reaches the Aurora channel at the end of September, though, type inference should just make your web surfing 20-30% faster — period.

Tagged In

Post a Comment

Honestly, they skipped 7,8 versions to go right to 9 to distance from predecessors? Mozilla lately keeps playing catch-up to Google Chrome.

Anonymous

ger over it

Petr Tomeš

No, of course they didn’t. You just don’t understand the rapid release cycles. There will be Firefox 7 and 8.

http://www.dragonblogger.com Justin Germino

Okay, I looked at all the Beta and they are just so many cycles ahead it is strange how they have so many cycles being developed in parallel paths, bugs found in one version need to be fixed in all future cycles…etc. What a frantic pace!

http://www.mrseb.co.uk Sebastian Anthony

Yup, frantic is the word. Anything to keep up with the pace of the web :)

Anonymous

I made a post about version numbers here http://www.sargodarya.de/news/single-view/archive/2011/07/article/welcome-to-version-hell/

http://www.dragonblogger.com Justin Germino

Agree with your statements exactly in your article.

DesertSun59

Um, no. I’m currently on 8.0.1.

http://www.dragonblogger.com Justin Germino

Honestly, they skipped 7,8 versions to go right to 9 to distance from predecessors? Mozilla lately keeps playing catch-up to Google Chrome.

http://twitter.com/eikke Nicolas Trangez

“Some languages are strongly typed, which means that the programmer must define the type of every class, function, and variable that he uses; tiresome, but it can have big pay-offs in terms of overall speed. Other languages, like JavaScript, are weakly typed, which means that the programmer doesn’t have to worry about such piffling minutiae; you can just write some code and let the compiler do the heavy lifting.”

This is wrong. Strong or weak typing has nothing to do with explicit type annotations. There are languages which require type annotations which are considered weakly typed (e.g. C), some are dynamic typed but not weakly typed (Python, LISPs), some are strong, static typed and require explicit annotations (Java, C# originally), and some (not necessarily the ‘newest’!) are strong static typed without any explicit/required type annotations: ML, Haskell, more recently C# (with the ‘var’ keyword), Scala,…

http://www.mrseb.co.uk Sebastian Anthony

See, that’s why I didn’t provide a full definition — I knew a commenter would help me out.

Thanks!

http://twitter.com/eikke Nicolas Trangez

You’re welcome :-)

http://twitter.com/eikke Nicolas Trangez

You’re welcome :-)

http://twitter.com/pcalcado Phil Calçado

What about updating the article, then?

Dylan Coates

this version is 32 bit but i really hope this effort is put more on Firefox 64 bit as 32 bit is going to be history soon. Windows and Apple will be 64 bit soon. i would just focus on that and forget about the people not upgrading.

maybe i’m too old for this, but it’s just me or there is really a race to produce the new next browser that really is the same old crap with a few addons around.

i was quite happy with FF4, and really never fel the need for more speed in javascript or..anything.

http://pulse.yahoo.com/_FBKAYHKCJHPE42M5QIMW2BJHWY black

Yeah, it’s just you. If you want to deal with slow javascript on the increasingly-javascript heavy web, feel free. The rest of us aren’t going to wait 5 minutes for a page to render.

http://twitter.com/Binarysemantic BinarySemantics

It would be tiresome for developer but at the same time would help in overall speed

http://pulse.yahoo.com/_RNKXDEDZCBA3RHOJ3V7UF2GWV4 Mai

some faster, but some slower ….
The normal array ‘ read/write does become faster than before even than chrome , but the image data array ‘s read/write turns to be much slower . I tested a array with 9000*1000, it is 4-5 times slower than 6.0.

I followed this post http://blog.n01se.net/?p=248 and there was a bug report here https://bugzilla.mozilla.org/show_bug.cgi?id=650939

Use of this site is governed by our Terms of Use and Privacy Policy. Copyright 1996-2015 Ziff Davis, LLC.PCMag Digital Group All Rights Reserved. ExtremeTech is a registered trademark of Ziff Davis, LLC. Reproduction in whole or in part in any form or medium without express written permission of Ziff Davis, LLC. is prohibited.