I had a question come up from a customer: so, IE9 JavaScript performance is faster, and IE9 has 4 different document modes – are there differences in JavaScript performance across the document modes?

Now, I kind of suspected that the answer would be yes, but I didn’t actually know any details – and as a general rule of thumb, I don’t like to just assume that what somebody else told me is true (or even that I am actually remembering correctly – I’m not getting any younger, you know) so I figured we would run a little experiment and see what happened.

I decided to use the SunSpider performance benchmark, which tests JavaScript performance. While there is a newer version available, that newer version doesn’t work with older rendering engines, so I had to run the older version. This is the specific test that I ran:

http://www.webkit.org/perf/sunspider-0.9/sunspider-driver.html

I then ran this test in each of the 4 rendering modes in IE9, and for good measure I also threw in a test of the latest Firefox and Chrome. These were the results of running the test in an uncontrolled environment, a single time, on my computer – I am not attempting to make a scientific statement about absolute performance, just to gain an understanding of whether there are differences which are large enough to matter.

image

Wow. The outcome seemed really clear to me: when in IE9 or IE8 standards mode, IE9 performance is very clearly competitive with other modern browsers. However, once you drop to the two oldest compatibility modes, performance drops by an order of magnitude – that’s a big deal!

Since Compatibility View is the default for the Local Intranet zone, I would therefore strongly consider a program of enforcing the inclusion of X-UA-Compatible headers to opt in to one of the modern document modes in order to maximize the performance of your enterprise web applications, which is precisely the advice I gave to my customer.

If your JavaScript performance is not what you’d hoped in IE9, perhaps you should press F12 and check your document mode…