Apparently, one of the factors that affects your Google ranking is how long it takes for a page to load. I doubt this will make an enormous difference to your ranking unless it is very slow, but it is worth considering, especially if you are in a very competitive industry and you are working hard to claw your way to the top.
Google don’t just use statistics from their bots though, they actually use data on load times from their toolbar that runs inside people’s browsers. That gives them a better idea of how long the page takes to load.
People do care how long it takes for a page to load. If your website is responsive and pages load instantly, they are more likely to hang around. If they have to sit and wait, even for a few seconds, they lose patience easily. That could make quite a difference to your conversion rate. Equally, Google monitor your bounce rate and how long people stay on your website. I’m not sure if they use that for ranking, but it is definitely worth bearing in mind.
In addition to worrying about the server hardware and how heavily it is loaded with other websites/services, bear in mind that the following also affect page load times: -
- server side code that runs when the page renders, especially if you access external systems including databases
- HTML size
- size of images
- CSS size
- Javascript size
- number of images/css files/script references on the page
- distribution of images/css files/script references across different domains (browsers usually limit how many files they will read from a single domain at a time)
- speed of data loading from other services
- caching policies and loading common references from CDNs or locally
- the position of css and script references on the page
OK, so what can you do about all these? There are plenty of articles on these topics, so I’m just going to go through the basics and leave it to you to Google for the latest info.
Minification
If you haven’t already minified your HTML, Javascript and CSS then do so if possible. This is just a process to remove all unnecessary whitespace to reduce the size. You can do this dynamically as the page loads, but if you do, make sure your server can handle the load and it is probably sensible to have some sort of caching system. If you minify code and CSS statically, make sure that you keep a copy of the original for when you need to change it later though!
Javascript packers
These are javascript libraries that pack your code up smaller and unpack it for use. I’ve not used any myself, but they can save a lot of space in some cases.
Compression
Most web servers can compress HTML, CSS and Javascript, including dynamically generated pages. Make sure you have this configured (usually gzip/deflate)
Simplify
Have a good long think about whether your HTML is as simple as it can be. It really shouldn’t need to be a tag soup in order to look good. You might have to make some minor visual sacrifices to save a lot of complexity. Think about whether clever use of CSS can save a lot of HTML.
Have a think about whether your CSS is organised well and logically. Can rules be combined?
Do you need all that javascript still? Can it be expressed in shorter form?
Images
Can you reduce the number of images? Is it worth simplifying the design? Do you actually need all the pixels you have on repeating images (eg. gradients only need to be 1 pixel wide/high, covered areas of images might be croppable). Make sure you are saving images in an appropriate format and compression level.
Combining files
See if you can combine multiple javascript files together. Same applies to CSS. This often has the additional effect of improving overall compression efficiency.
Look into image sprites.
Loading from multiple domains
If you absolutely have to have those 25 images (or javascript/css references) on the page, see if you can spread them across different domains. Even subdomains work, although a separate domain is a little better as you can make it cookieless and save a few extra bytes on each request. In fact, loading all references from another domain can save a bit on the cookie overhead.
Local/remote references
Work out whether to have referenced items stored locally (even if on another domain) or loaded from an external source. Many common libraries, such as jquery are hosted on public CDNs. There is a reasonable chance that a visitor may have it cached in their browser from there. On the other hand, some external references may be slow, might not be minified/compressed etc and it may be worth considering whether you can host these yourself (factoring in the pain of having something else to update unless you come up with a clever caching system). Don’t forget to test this, and don’t forget that your visitors are likely to be coming from all over the world. If they load a page from the other side of the world, they will be faster accessing a CDN than your local server.
Caching
Make sure that your visitors aren’t needlessly reloading files that haven’t changed too much. Ensure that you have appropriate headers set up to control caching. This is a complex subject and you might want to spend some time reading up on it.
Position of CSS/Javascript references
It isn’t obvious, but where you place the CSS and javascript references on the page make quite a difference to load time, because of the way that the browser handles rendering. CSS should probably be near to the top as it will need to be able to start retrieving this ASAP in order to render the page layout correctly. Javascript can usually be left to nearer the bottom and you may way to even consider deferring and adding the references dynamically after the page has loaded so that users can start reading while the javascript kicks in (depending on what it does). Again, other people have written a lot more on this subject.
Testing
There are loads of things that you should test. Monitor the sizes of the various different files that load, the numbers of files, the load time etc. Do this using browser tools (many browsers have it built in), external web services such as http://analyze.websiteoptimization.com/wso and http://www.webpagetest.org/ . Don’t forget that different browsers respond differently, as does different hardware, different platforms (don’t forget mobiles and tablets these days!), different ISPs and different locations.
Some other tools that are worth looking at are YSlow and Google Page Speed.
This can all be pretty time consuming, so the question is whether it is worth it. It really depends on whether you are having major problems at the moment, how big and important your site is and how much you think it is affecting your visitors. That’s something that you need to think about and decide on.
Have I missed anything? Let me know!