Learn how to speed up your website
However, the amount of time that can be saved will be strongly dictated by your hosting company and the type of site you have: static vs dynamic, hand coded vs blog vs CMS.
Optimising your website’s speed
NetAccountant has been optimised for the purpose of this article – and to keep you and Google happy. Here’s the original performance table from Web Page Test:
Less than 4 seconds is quite a good time for a shared hosting account. But Google’s – unrealistic – definition of a fast site is one with a loading speed of less than 1 second, so let’s try to shave a second or two off my time.
One of the larger picture file I was using was the logo (over 20Kb). After some manipulation in an image software and further compression using Yahoo’s Smush it, it has been reduced by half without any loss in quality.
Smush it is actually a great tool available in YSlow and it allows batch processing of all the images that are on a page. Note: it won’t optimise images that aren’t on the page, so you may have to manually add their URL or make sure you “smush” pages that contain all your different images. The other thing to be aware of, is that “Smush it” may change the image format/extension, so you cannot simply re-upload them back, you may need to change your HTML as well.
Text File compression
This is something I was unable to implement, unfortunately, as the shared hosting account I have doesn’t allow it. Compression requires more CPU resources and it impacts all the sites on the server. The hosting company’s decision is therefore understandable.
However, I have used it in the past with great result and I’d like to share the code to be copied in the .htaccess file if your host has mod_deflate enabled.
Caching of static elements
These above directives will have the following result:
- favicon will be cached for 1 year
What else can be done?
There are 4 other points I’d like to discuss before concluding this article with a new test.
- CDN or Content Delivery Network, are servers, or clusters of servers, configured to be extremely fast and clever: they send the files from the closest server to your visitor. In my opinion they are only useful for very popular sites, or sites with large or many files to download. I would say that in 95% of the cases your website doesn’t need a CDN especially if your own server is already responsive.
- Combining images as sprites: I may do a tutorial at some point about CSS Sprites, but for now have a read through this great a list apart article explaining what sprites are and how to use them. In a nutshell, sprites are images being combined into one, so that the browser only needs to download a single file. You then use CSS to decide which image to show.
A gain of just over a second on the “first request” is very satisfactory in my opinion because of the relatively good first performance.
40Kb were saved in file size from smushing images and minifying some of my Thesis files. I would also add that I have been working on websites for a while, and had already applied some of the time-saving techniques I knew about (relatively well optimised image files, use of WP Super Cache, lean and valid HTML code).