CSS Selector Performance
Filed under CSS, Performance
Jon Sykes has investigated the performance of child selectors in a series of tests. Read Part 1, Part 2, and Part 3.
While his findings show that type and class selectors are rendered more rapidly than descendant and child selectors, the example files are (necessarily) exaggerated in order to demonstrate the performance impact.
I’d like to see a well-coded, real-world example (one which balances type, class, and ID selectors with descendant and child selectors) vs. an example that exploits the use of class selectors (and is probably less efficient over all due to excess code) — I would guess that they’d perform about the same. And, as pointed out elsewhere, the well-coded solution will be easier to maintain in the long run, which would well be worth the extra milliseconds on the client.

Comments (0)
You can leave a comment or pingback.
Reply to “CSS Selector Performance”