When using a table with a reasonable amount of data - 100 rows by 50 columns - I notice that IE8 performance degrades unacceptably (only in IE8 standards rendering mode). The CPU usage spikes to 100% and the browser becomes very sluggish. Increasing the amount of data in the table amplifies the sluggishness.
This became apparent when applying a background color on hover on a row, but the performance degradation seems to occur with any style change, and unrelated to the hover event handling.
Attached is a very simple test-case with which I can consistently reproduce the problem.
A couple of notes concerning the issue:
- Dynatrace reports show that nearly 100% of the CPU time is spent on "Calculating Generic Layout". This does not occur if
<div>s are used instead of tables (see below). - Switching the Document Mode to IE7 Standards or Quirks Mode via the Dev Toolbar fixes the problem.
- Due to constraints imposed on the environment I work in, IE8 runs in IE8 Compat Mode Browser Mode, with IE8 Standards Document Mode. Changing this setting through the Dev Toolbar doesn't have any effect on performance.
- Replacing the
<table>solution with<div>/<span>approach improves performance, ruling out the amount of DOM nodes in itself as the culprit. - The example adds mouseover events to each
<tr>, but using event delegation doesn't mitigate the problem. In fact, if I replace the mouseover solution with asetIntervalwhere every 50ms a random row is highlighted, the same performance degradation occurs. - I have tested and confirmed this behavior on several different machines (all Windows XP, Intel Core Duo @ 2.33 Ghz, with 3.5 GB RAM) in my work environment. All exhibit the same behavior.
- I have tested HTML 4 Strict, XHTML 1.0 strict and HTML5 doctypes. All exhibit the same behavior.