Website Redesign: Performance Audit
One of the goals of redesigning my personal site was to improve performance. You know, things like how fast it loads, how many things are being loaded and such.
My existing site design actually did pretty well for a site that hasn’t been touched in six years. Here are a few of the metrics that I pulled from WebPageTest:
|Time to First Byte||2.782s|
Those 46 requests (and 764 KB) freaked me out a little. For crying out load, where were those coming from?! I guess I relied pretty heavily on third-party libraries and scripts, but I had no idea it was that many.
I went ahead and started optimizing things in a few kew ways.
Remove unnecessary scripts
The first thing I did was go ballistic on third-party scripts. One piece of low-hanging fruit was the site’s typography. I had been using Typekit (now Adobe Fonts) to serve custom fonts and, while they do an excellent job optimizing things on their end, I no longer see the value in having special fonts on my site at all. So, I ditched all fonts and went with a system font stack that uses the default font of the user’s operating system:
Good good, one down… and so many others to go.
Another culprit was jQuery. Now, I’m not on the bandwagon that says jQuery is bad in modern web development. It’s a wonderful language and I’d still use it on projects, if it made sense for the job. It’s just that this particular job didn’t require it. WordPress includes it by default, so I went ahead and removed it:
Notice that I’m only removing it from the front end of the site. I think WordPress uses it in the admin, so I wanted to make sure it stays there.
As I kept digging into scripts, I noticed saw another Jetpack relic in the source code. This time it was a CSS file the plugin was loading. I’m not sure why, but I’m pretty confident my front end views aren’t using it. Turns out Chris wasn’t either when I found his post sharing how to remove it:
A couple of other housekeeping things I was able to do to help improve things:
- Use inline SVG whenever possible.
- Use as few raster images as possible (only one!)
Those two little things must’ve made a huge difference because the total number of requests fell down to eight when all was said and done. That’s a 82% decrease!
Delegate images to a CDN
Images might be one of the biggest offenders when it comes to bloated webpages. Whether it’s using too many of them, using files that are super large, or serving them from your own server, the fact is they weight things down quite a bit. As of today, the average webpage serves 980 KB of images to desktops.
I mentioned earlier that I am now using one raster image on my homepage. That’s different from the several I used before.
I used to compress images using the Smush plugin. It basically squeezes files when they’re being uploaded to the WordPress media library. It’s a great tool.
This time, I decided to delegate my image delivery to a CDN. I signed up for a free Cloudinary account and connected it to WordPress with the Auto Cloudinary plugin, which is super simple to set up. Cloudinary has it’s own WordPress plugin but, gosh, it hijacks the entire Media Library experience by forcing you to use their UI to upload files. Auto Cloudinary merely connects WordPress to a Cloudinary account so that any files that are uploaded to the Media Library are sent over to Cloudinary and served up from there. Yes, that’s a third-party thing, but I figure the ability to use WebP for images and leverage Cloudinary’s CDN makes for a good trade-off.
Images made 11 of requests (or 15.5%) on my site before the redesign. Now it’s a single request. That single request does account for 71.2% of my overall size, but (as we’ll see) that’s only because I’ve decreased other assets so signifcantly that the one image dominates everything.
I’m not anti-framework or anything, but they do force you to confirm to their coding standards and use assets that require them to work. Foundation was my favorite because I really enjoyed the syntax for their layout grid. The only problem is that I had to inherit a bunch of other code to use the grid.
Well, hello CSS Grid! Now that CSS has this new layout superpower, I was able to ditch Foundation (or any other pre-fab grid) and roll my own with a few lines of code.
That’s it. Seriously.
Remember when I said I ditched fonts? It’s a good thing I did, because that killed 118 KB for a grand title of zero. Zilch. Nada. Bueno!
The site already been doing a pretty good job of this before the redesign, so not much a change here. I’ve been using the W3 Total Cache plugin for some time and don’t really see any reason to stop.
I guess it’s good practice but caching annoys me. Getting too aggressive requires purging the site on a regular basis or forcing your visitors to clear their browser cache — not the best user experience.
|Metric||New Design||Old Design||Difference|
|Time to First Byte||2.362s||2.782s||-15%|
|Data||182 KB||764 KB||-76%|
|Repeat Data||0 KB||NA*||NA*|
*I lost the test results before I documented them. Ugh.
I also ran both versions of the site through Lighthouse and saw a decent improvement in the performance score, going from 84 to 99.
There’s still a bit of work to do before I’m ready to call the redesign baked. I’m definitely happy with the performance gains. A Lighthouse score of 99 is fantastic in my book and the fact that the single point I lost was due to the Time to First Byte means I’ve done all I can do to make things load quickly. Well, perhaps I could try to move my hosting over to Netlify to earn that point, but it’s not high on my list.
What is high on my list is accessibility. I tried to be pretty intentional about it going into the redesign but I neglected to test several things. That will be my next focus.