How To Speed Up Your Website

Oh website speed – where art thou? The benefits of improving your website’s load speed is well documented – people like fast websites. If your website is fast, people are going to stay longer and surf more pages. Moreover, Google is going to have a better time crawling your website and this might help your SEO.

But do you increase your website speed?

Here at Acoupletravelers I’ve been working over the past month to increase my website speed. There’s been some ups and downs as part of the experimentation, but overall I’m relatively satisfied with where we’ve ended up. I can’t write an exhaustive guide on this, frankly, any one implementation could almost be an entire article in and of itself. Instead, I will cover a few highlights that may make for some noticeable improvements with some quick changes.

Leverage Tools

There are several tools out there on the web that are great for taking a look at your website speed and making suggestions. Two popular ones I use are:

Pingdom Tools: This is a nice site for quickly testing the page speed. The performance tab also highlights some areas where you can improve.

Gtmetrix: This one is a bit more in depth as it ranks you based on PageSpeed as well as YSlow and gives a ton of suggestions as to where you can make improvements. I also like the feature that you can run your website against other websites to see how they compare.

TIP:Remember with tools that you don’t just have to input your own website. i’ve used tools as a way to see what other websites were running on the backend – often you can identify plugins from the .js or .css files that are called so that can be helpful.

Utilize Plugins

There are a lot of great plugins that are specifically intended to speed up your website. I’ve outlined many of them in my favorite wordpress plugins. Namely, W3 Total Cache, WP-Clean Up, and Lazy Load. In fact, you can make huge gains simply by correctly setting up W3 Total Cache. Here is a great guide, which gives detailed instructions on setting it up. Do this before you attempt anything else.

Images Carry A Lot Of Weight

Images can often be the bulk of the download time. If you’re site is very image heavy you might want to make that the focus of your optimization. The great part is that images are often the easiest performance issues to fix. A lot of what is necessary is handled in a few areas, such as:

  • Optimize images – This just means that images can often be compressed using image optimizer sites or plugins like WP Smush.it (I’ve had a bit of trouble with this FYI). You shouldn’t notice a drop in quality but the image file will be smaller.
  • Serve scaled images – This means that if you are displaying an image to be 750 x 500 then the original should be resized to 750 x 500, not scaled down on the fly from 3000 x 2000. In some cases there isn’t much you can do (like if you’re generating thumbnails). But if you have static images then you should make sure they reflect the correct size.
  • Specify image dimensions – Pretty simple too, it just means that you should specify your image width and height in the html (or css). So, for example:

<img src=”https://fooddoodles.com/wp-content/uploads/2011/06/tasteo150.png” alt=”my tasteologie gallery”>

should be

<img src=”https://fooddoodles.com/wp-content/uploads/2011/06/tasteo150.png” alt=”my tasteologie gallery” width=”150″ height=”150″>

  • Combine images using CSS sprites – This is a bit trickier, or at the very least, requires some basic knowledge of CSS. Essentially it is combining all of your static, background images into one file and then referencing them individually in that file. Imagine that there is some fixed cost with each image you call, so now you only have to call one and you just reference different parts of it. To give you an idea of what I mean, here is the sprite for our home page:

If you’re interested in trying this I highly recommend Chris Coyer’s article on how to use SpriteMe.

Combine External Files

When you can you want to combine external file sheets, like CSS and JS files, instead of referencing them individually. Again, this is similar to that idea of cutting down on the fixed costs that are associated with referencing everything individually. W3 Total Cache does this for a lot of the style sheets but sometimes it doesn’t hit them all. This is particularly important with plugins as most plugins are written independently and therefore have their own css and js files. In some instances you can just add the css to your main style sheet. For example, with the plugin commentluv that we use, I noticed it was calling commentluv.css, so I just opened up that file and copied the css that was there into our main style sheet. Then I killed the reference to commentluv.css in the plugins .php file. Careful though, this doesn’t ALWAYS work, and you should really do it one sheet at a time. Sometimes the files are so interwoven you just can’t kill one off.

Minify Code

Minifying code basically means compressing it, like with images, but with code. You get rid of all the comments and space and cram everything together so it’s not even readable to humans anymore. It doesn’t change the code but it cuts down on the file size. Again, W3 Total Cache can do this as well but to be honest I’ve had a few problems with this. Sometimes when you minify code it gets a bit screwy. It’s another case by case basis like with combining external files. Try it one by one with your files and see how it works. As always come up with a good naming convention and preserve the original file and name the new one file-min.js. There are plenty of free minifying programs on the web.

Set Up Cloudflare

Cloudflare is a free Content Delivery Network (CDN). Essentially it stores your static content on a local host so that when users try to access it they can get it from a host that is closer to their location instead of your server location, which may be farther away and hence take more time to reach. In my experience it is very easy to set up and results in some very noticeable gains. You have full control over how it optimizers, and can purge the cache with the click of a button so you never need to worry about outdated content being delivered to your viewers. Cloudflare also has some nice applications focused on site optimizers and like W3 Total Cache can combine external files and minify code. I haven’t had any problems running the two together.

Get Rid Of Unused CSS/JS

It’s always good practice to get rid of things when they aren’t needed. One thing I did was I created a style sheet specifically for my home page and one for all my other pages. In my header.php I created a condition that looks like:

<?php

if (is_home()) {
echo “<link href=’https://acoupletravelers.com/wp-content/themes/journey/styles/blue-home.css’ rel=’stylesheet’ type=’text/css’ />”; }
else {
echo “<link href=’https://acoupletravelers.com/wp-content/themes/journey/styles/blue.css’ rel=’stylesheet’ type=’text/css’ />”; }
?>

The home page style sheet has css that only relates to the home page. I separated out this page because it’s the most popular one and therefore the most important to be optimized. You can do similar things with .js files by only calling the ones you need on specific pages (easiest is just to do home page or not).

Closing Words

Don’t go crazy – there is only so much you can do! Some things just can’t be tweaked. One of the reasons I don’t have perfect 100s is because the code for feedburner and google analytics don’t have expired headers. Since this isn’t my code there isn’t anything I can do if I want these applications to run on my website. Furthermore, a lot of stuff may result in very minimal gains – like, miliseconds. Is it worth hours of aggravation? Probably not. Also, don’t get hung up on the score too much. There is a difference between page load and when the user sees content. A lot of JS files load after the content and therefore don’t effect the user experience, but when your running these reports you may get penalized. If you have any questions post in the comments and I can take a look at how your webpage performs in the various tools and maybe make some quick suggestions.

What have you done to speed up your website?

If you enjoyed this article, join others and get free email updates!

3 Responses to How To Speed Up Your Website

Leave a Reply

Your email address will not be published. Required fields are marked *