tl;dr; The critical CSS solution, using
minimalcss, yields a 40% improvement in First Meaningful Paint and 90% improvement in the Time to Start Render.
About a month ago I enabled minimalcss here on my personal blog to properly test it in production. In that blog post I only looked at the difference in file size. This time, I'm testing the impact of it using Webpagetest.org. I picked two blog posts (that don't have images), but both have some syntax highlighting of code CSS. One and Two. Doesn't matter what's in those two pages but they're relatively similar in shape and size.
In three Webpagetest.org experiments I compare, on 4G Chome...
Note! In the following screenshots from Webpagetest the "Thumbnail interval" is set to 0.5 seconds.
Note2! These pages used HTTP/2 and the CSS stylesheets are loaded from a CDN.
BOTH pages optimized
They are about 0.3 seconds apart in their first meaningful paint.
This is the baseline comparison. It's not perfectly the same first-meaningful-paint but close enough. The point is what difference it makes later.
Only FIRST page optimized
The optimized page is 0.7 seconds faster.
Only SECOND page optimized
The optimized page is 1.4 seconds faster.
Bonus! Both pages NOT optimized
Just to check that it all holds up. Here, both pages are compared with out the critical CSS optimization.
If we roughly average out the first paint on the sample where both were optimized (2.1 seconds), this time it's 2.8 seconds. So the optimization of the critical CSS with
minimalcss roughly makes the first paint makes it 40% faster.
In Webpagetest.org the "First Meaningful Paint" is just one of many ways of measuring "success". I put that last word in quotation marks because this stuff is not trivial. Just because you manage to show anything to the user doesn't necessarily mean the user is happy if the user can't do what they want to do. And if you front-load a bunch of things with every trick in the book, you might have a lot of load in the background that might affect the scrolling with yank or flashing content.
I never really know which one to live by as a measure of success but the visual comparison timeline from Webpagetest definitely is fruitful and easy to understand. There is also "First Contentful Paint" which shows a slightly bigger difference between the optimized and the not-optimized pages.
For now, I'm going to call this a success. Adding
minimalcss was a mixed bag of challenges. The execution of the script, on a server, requires the right amount of tooling and safeguards. After all, it depends on real web browser running inside a web server spawned from a background asynchronous message queue task with retries, logging, and metrics.
For one thing, if you just look at the visual comparisons and focus only on the rendered title the difference is not 40% faster. It's about 100% faster. That difference is explained by the word "meaningful" in First Meaningful Paint. The rest of the content is at the mercy of the banner ad and the remote loaded web fonts. For example, if you instead compare the "Time to Start Render" average timings of the optimized pages was 1.6 seconds vs 3.1 seconds for the not optimized pages. In other words, the improvement of First Meaningul Paint was 40% and the improvement of Time to Start Render was 93%.
Lastly, remember that what
minimalcss (and other critical path CSS optimization tools) does is that it copies CSS from the
.css files and includes it in the HTML document. That copying means the HTML document weighs 27KB more and still it wins.
I need to carefully read https://docs.google.com/document/d/1BR94tJdZLsin5poeet0XoTW60M0SjvOJQttKT-JK8HI/view and https://speedcurve.com/blog/rendering-metrics/ to improve my understanding of these metrics.
Google says that FCP - First Contentful Paint should be under 1.7 seconds
FMP - First Meaning Paint should be under 2.2 seconds and that TTI - Time to Interactive should be between 2-3 seconds
I found this post, https://www.speedboost.xyz/blog/know-about-first-paint-time-contentful-meaningful-and-time-to-interactive/ while searching for render time and the metrics like CSS and JS which constantly affects the load time and the performance.
Where do you get those numbers for? Because that obviously depends on the hardware and internet connection.