The 512KB Club part 2: Going below 100KB

WordPress released the first beta for 6.1, including the all-new default theme, Twenty Twenty Three, and on a whim I decided to try it out and see if I can squeeze a few extra bytes after my first attempts at optimization. I’m happy to report that this site is now around 93 KB uncompressed and 20 KB compressed! This is a huge leap from just days ago, when the compressed size of the size was 97 KB.

The Twenty Twenty Three theme brings a new concept of “styles” that act as sub-themes; they are also defined in JSON files instead of CSS, which is probably what makes it so much smaller by default. What weighs it down are once again the bunch of custom fonts it brings along, most notably Source Serif Pro at 418KB. Additionally, there are also a number of weird requests to CSS files that are not there – this is probably just a bug that will be resolved before WordPress 6.1 is released, but for now, these 404 errors only add up to the page load time. Edit: those extra requests to CSS files that were 404ing have been resolved in Beta2.

Once again, I started with a child theme. For some reason, the dequeue hack did not work on this theme’s fonts, but the theme.json file makes it easy to simply erase the whole “fontFace” array. This removed those heavy fonts, but for the non-existent styles, I once again had to turn to wp_dequeue_style – luckily, it worked:

function my_dequeue_fonts() {
add_action( 'wp_enqueue_scripts', 'my_dequeue_fonts', 11 );

The final results after this round of optimizations:

20.7/93.7KB and 527ms to LCP – simply mind-blowing results.

Post-final thoughts

At some point I guess I’ve removed the dequeue script shown above, and blocked the stupid fonts in a different way – I don’t recall when, why or how. I’ve also recently added two modifications, but I used plugins this time as I’m lazy. First, I’ve improved the appearance and predictability of excerpts with the Advanced Excerpt plugin, and I’ve also disabled the wp-emoji-release file with Disable Emojis as it was beginning go get huge and doesn’t seem to affect the site in any meaningful way. This has further brought the homepage down to around 81 KB. I don’t think that it would be sensible to work on this any further.

I’ve also made a small quality of life upgrade on my end – the “recent* quick reads” list on the bottom of the homepage is now an excerpt of a separate page which can keep on growing. I can now edit the page directly instead of the homepage.