Nov 18, 2010 17:31 GMT  ·  By

Internet Explorer 9, the next generation of IE, features a new JavaScript engine, codenamed Chakra, with the work on this area of the browser being responsible for the significant gains in performance associated with JavaScript according to the WebKit SunSpider JS microbenchmark. Recently, Rob Sayre, Mozilla JS engineering, raised some questions about the way in which IE9 dealt with one aspect of SunSpider (the math-cordic test), which allowed the browser to complete it in as little as 1 ms while rival browsers did it in 10 ms.

According to Dean Hachamovitch, Corporate Vice President IE, IE9’s Chakra brings to the table a new JS speed optimization obtained through dead code elimination.

“Briefly, the IE9 JavaScript engine includes many different changes to improve the performance of real-world Web sites and applications,” Hachamovitch said.

“You can see this in action by visiting www.ietestdrive.com and trying the samples there with IE9 and other browsers. The behavior of the IE9 JavaScript engine is not a “special case optimization” for any benchmark and not a bug.”

IE9 dead code elimination is nothing more than optimizations to the JavaScript interpreter/compiler, which allows the browser to essentially skip code that is unnecessary to run a specific application.

“Dead code elimination optimizations look for code that has no effect on a running program, and removes the code from the program. This has a benefit of both reducing the size of the compiled program in memory and running the program faster,” Hachamovitch added.

The Corporate VP for IE did underline that the manner in which the SunSpider math-cordic test runs a loop will trigger this specific optimization in Internet Explorer 9, allowing the browser to wrap it up in a tenth of the time it takes other browsers.

“The interest in this issue is a great example of why these microbenchmarks fail to represent the real world web. Webkit Sunspider uses an expensive JavaScript loop to approximate sine and cosine. Real world sites would actually use the much faster and CPU-optimized functions already available in JavaScript engines,” Hachamovitch said.

Sayre read Hachamovitch’s reply and posted one of his own, warning that naïve implementations can produce unexpected and even erroneous results.

Mozilla’s engineer goes on to offer a few examples that are designed to illustrate some issues with the work done for IE9.

“I don't think it's possible to consider IE9's implementation of Dead Code Elimination to be a serious general purpose optimization. It seems clear that it hasn't been tested on anything other than SunSpider,” Sayre concludes.

But SunSpider-related optimizations aside, fact is that only milliseconds separate IE9 from rival browsers. I’ll say that again: milliseconds.

And don’t thing for a second that SunSpider is a reflection of real-world performance, because it simply is not.

This is what the IE team has underlined time and again, while noting that work done to increase the performance of IE9 cover all aspects of the browser and is not limited to Chakra or JavaScript.

Internet Explorer 9 (IE9) Beta is available for download here.

Internet Explorer 9 (IE9) Platform Preview 7 (PP7) is available for download here.