Sep 5, 2011

Good news for all Firefox users, especially those running the latest Nightly builds of Firefox 9 or those planning to upgrade to the new version of the web browser once it becomes available in other Firefox release channels.

Mozilla developer Brian Hackett worked on a new feature called type inference for over a year. You may know that you need to define types for variables in some programming languages, while it is not necessary to do that in others. JavaScript for instance does not require type definitions for variables. The downside here is that this practice can have an impact on performance.

Type inference now refers to an algorithm that is automatically deducting the type of an expression.

On my machine, TI takes our Kraken score from about 4900 to about 3400, a 1.44x speedup. And on V8-v6, our score goes from about 5000 to about 6600, a 1.3x speedup.

Sebastian Anthony over at Extreme Tech did some measuring of his own and came to the conclusion that the performance gains depend largely on the benchmark used. He noticed performance improvements between 15% to 30% in benchmarks on a Intel i7 930 processor with 6 Gigabytes of RAM and a fairly speedy Nvidia GTX 460 video card.

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.

Interested users can download the latest Mozilla Central release with type inference enabledfrom the official Mozilla ftp server. The next Firefox channel to get type inference is Firefox Aurora, which is going to be released on September 27. Firefox Beta will get the feature on November 8, and the stable channel on December 20.