Optimising Performance
There are several measures you can take to improve the performance of IE7 on your site. They are listed (roughly) in order of importance.
Standards Mode
Include a DOCTYPE as the very first line of your HTML
page to ensure that IE is in
standards mode.
This will improve performance in IE6.
Efficient CSS
I’ve recently seen several articles about writing efficient CSS. These articles usually describe how to use shorthand CSS properties to minimise file size. This is not the kind of efficiency I’m about to describe. IE7 includes a CSS query engine to implement CSS2 selectors. Because IE7 is written in an interpreted language (approximately 100 times slower than a compiled language) the CSS engine is noticeably slower.
You can improve performance in a couple of ways:
- Start selectors with
#IDwhere possible:/* fastest */ #content {..} /* slowest */ div#content {..} - Avoid universal (
*) selectors where possible:/* fastest */ div.content {..} a[href] {..} /* slowest */ .content {..} [href] {..}
Avoid using the strict CSS file
The optional module ie7-strict.js
provides IE7 with strict CSS precedence. The bad news is that it drastically affects
performance. Include this module only if you have to.