Geez, leave it to Patrick Brosset to talk CSS performance in the most approachable and practical way possible. Not that CSS is always what’s gunking up the speed, or even the lowest hanging fruit when it comes to improving performance.

But if you’re looking for gains on the CSS side of things, Patrick has a nice way of sniffing out your most expensive selectors using Edge DevTools:

  • Crack open DevTools.
  • Head to the Performance Tab.
  • Make sure you have the “Enable advanced rendering instrumentation” option enabled. This tripped me up in the process.
  • Record a page load.
  • Open up the “Bottom-Up” tab in the report.
  • Check out your the size of your recalculated styles.

DevTools with Performance tab open and a summary of events.

From here, click on one of the Recalculated Style events in the Main waterfall view and you’ll get a new “Selector Stats” tab. Look at all that gooey goodness!

Now you see all of the selectors that were processed and they can be sorted by how long they took, how many times they matched, the number of matching attempts, and something called “fast reject count” which I learned is the number of elements that were easy and quick to eliminate from matching.

A lot of insights here if CSS is really the bottleneck that needs investigating. But read Patrick’s full post over on the Microsoft Edge Blog because he goes much deeper into the why’s and how’s, and walks through an entire case study.

To Shared LinkPermalink on CSS-Tricks


The truth about CSS selector performance originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

Sourceid="more

height="1728"“Enable

src="https://techprosalways

andinto

matchedhere

com/thecase

loadhere

css

Leave a Reply

Your email address will not be published. Required fields are marked *

Explore More

State of the Word 2023 – Madrid, Spain

The countdown is on for this year’s State of the Word! If you missed the initial announcement a few weeks ago, you’ll want to mark your calendars for December 11,

Nairaland is back up after three day blackout

2 min read For years, Osewa has been approached by teeming fans of Nairaland to tweak the forum and scale it to become like Reddit but he didn’t seem keen.

Glo Football Plan: Activate 10GB for N1000, 4GB for N500

Glo is at it again, and you should be aware of the Glo Match Day Special Data Offer, which always pops out as a text message on your phone screen