Website Redesign: Performance Audit

January 3, 2020Updated: January 4, 2020

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 Byte2.782s
Fully Loaded5.3s
Requests46
Data764 KB

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:

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

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:

function change_default_jquery( &$scripts){
  if(!is_admin()){
    $scripts->;remove( 'jquery');
    $scripts->;add( 'jquery', false, array( 'jquery-core' ), '1.10.2');
  }
}
add_filter( 'wp_default_scripts', 'change_default_jquery' );

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:

add_filter( 'jetpack_sharing_counts', '__return_false', 99 );
add_filter( 'jetpack_implode_frontend_css', '__return_false', 99 );

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.

Get stingy with CSS and JavaScript

I really thought these were going to be the headaches but optimizing CSS and JavaScript on my site wound up being a breeze. The reason? I’m no longer using a framework!

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.

body {
  display: grid;
  grid-template-columns: 1fr 3fr;
  grid-template-areas: 
    "navigation main"
    ". footer";
  grid-gap: 75px;
}

That’s it. Seriously. 🎉

Given that I could ditch entire framework of CSS and JavaScript for those few lines of code meant that my CSS dropped to 11.2 compressed kilobytes… from 51.2 KB. That’s a 78% reduction overall!

Same deal with JavaScript: It went down from 305.9 KB to 8.4 KB, or 97%!

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!

Cache aggressively

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.

The results

MetricNew DesignOld DesignDifference
Time to First Byte2.362s2.782s-15%
Fully Loaded2.907s5.3s-45%
Requests846-45%
Data182 KB764 KB-76%
Repeat Load0.412NA*NA*
Repeat Requests0NA*NA*
Repeat Data0 KBNA*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.

A Lighthouse screenshot showing a performance score of 84.
Results before the redesign
A Lighthouse screenshot showing a performance score of 99.
Results after the redesign

What’s next…

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.