I wasted a day on CSS selector performance to make a website load 2ms faster | Trys Mudford
Briefly

Despite knowing that modern browsers efficiently handle CSS selectors, I was alarmed to see a delay of 270ms in style recalculation during every DOM change and page load.
I stumbled upon the 'Enable CSS selector stats' feature in dev tools, which revealed extensive match attempts versus match count in CSS selectors, highlighting an area ripe for optimization.
The observation of main thread locking under 'Recalculate style' indicated that improving CSS selector performance might yield significant improvements in perceived loading time.
Though it's tempting to disregard CSS selector performance, my traces revealed that a few well-chosen optimizations could enhance the overall efficiency of our Next.js app.
Read at Trysmudford
[
|
]