As I brought out in chapter 2 of
Blog Traffic Made Easy, statistics show that you only have about 3 seconds to capture the attention of your website visitors before they get bored and go somewhere else. You have a lot to do within those first 3 seconds, and you don’t want to waste it all on having to wait for your page to load. I’ve received a few emails from people telling me that they’ve done all they could think of, but their site still takes too long to load. Even John Chow is
tweaking his new theme as much as possible to improve its load time.
As I was designing SiteFever’s new theme, I wanted to optimize it for speed as much as possible. I ran speed tests during each stage of the optimization process to record the effects it had on my site. Here’s what I came up with:
NOTE: To test my page load time, I used Numion’s stopwatch tool. The average page load time before I did any optimization was 4.268 seconds.
1. Cache static objects
The first time a person visits your site, the page requested may have to make many HTTP requests for stylesheets, images, flash, etc. By instructing your site to cache certain static objects, a browser will only have to load these objects once. Subsequent pageviews by the same visitor will require much less requests, thus significantly reducing your page load time.Â
Here’s what I inserted in my .htaccess file:
ExpiresActive On
ExpiresByType text/css “access plus 2 weeks”
ExpiresByType text/javascript “access plus 2 weeks”
ExpiresByType image/png “access plus 1 month”
ExpiresByType image/gif “access plus 1 month”
ExpiresByType image/jpg “access plus 1 month”
The above code will cache my stylesheet and all javascript for 2 weeks and all .png, .gif and .jpg images for 1 month.
After making this optimization, my average page load time took 3.214 seconds.
2. Merge all stylesheets
It’s a proven fact that a browser will load one large stylesheet much faster than multiple smaller stylesheets. I noticed that the threaded comments plugin came with its own comments.php file and stylesheet. This meant all of the comment styles in my original stylesheet were no longer being used. I removed all of the unused styles and moved the new threaded comments styles from briansthreadedcomments.php to style.css so that I now only have one stylesheet to call.
After making this optimization, my average page load time took 2.637 seconds.
3. Display 7 posts per page
This is a technique that John Chow also mentioned he used to help reduce his page load time. I was displaying 10 posts per page (including my homepage), now I am only displaying 7.
To change these settings using Wordpress, login to your admin panel and go to Options > Reading > Blog Pages.
After making this optimization, my average page load time took 1.811 seconds.
4. Compress images
Using XAT’s Image Optimizer program, I was able to reduce many of my image sizes by about 40%. I then re-uploaded the newly compressed images and measured my load time.
After making this optimization, my average page load time took 1.653 seconds.
5. Cleanup code
Lastly, I simply went through all of my theme’s files removing duplicate and unused code. I also removed unnecessary comments and line breaks throughout the files thus reducing the size of each file. I would only recommend you try this step if you are familiar with PHP and HTML, otherwise you could really mess up your blog! Even if you do feel comfortable doing this, you should always backup your files anyway.
After making this optimization, my average page load time took 1.493 seconds.
In the end, five simple optimization techniques that took me no longer than an hour reduced my average page load time by 35%! Not bad.
Be sure that you optimize your blog to load as fast as possible. Doing so will allow you more time for the real “meat and potatoes” of your site to make a good first impression and will keep your regular visitors happy.
Enjoyed this article?
Subscribe to
SiteFever.com's
Full Feed RSS to get daily updates of this blog!
Be a good sport and promote my article! -
del.icio.us
-
Furl
-
Netscape
-
reddit
-
StumbleUpon