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 and they wanted to know what some of the methods were that I implemented in order to get JWRmeda to load so quickly.
When my blog first went online, I wanted to optimize it for speed and for the search engines 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, simply inserted the following code somewhere on my page:
The average page load time before I did any optimization was 2.138 seconds.
1. Cache objects
Hereâ€™s what I inserted in my .htaccess file:
Header set Cache-Control "max-age=604800, public"
The above code will cache all jpg, jpeg, png, gif, css, js and swf files for 1 week. For more information on enabling caching with .htaccess, see cache filetypes.
After making this optimization, my average page load time took 1.447 seconds.
After making this optimization, my average page load time took 1.034 seconds.
3. Cut down your page content
Many people who own blogs will display up to 10 posts on the same page. This is a lot of content to load. Instead, try cutting it down to 5 or 4. Chances are nobody is going to sift through 10 of your most recent posts anyway, and now your pages will load faster.
I was never using more than 4 posts per page, so I don’t have a new page load time to share with you.
4. Compress images
Image compression is a HUGE factor for most website owners. First off, you should never upload a large image then specify a smaller size in your HTML code. If you want to display an 800px wide image in only 400px, resize it on your computer first instead of specifying a smaller size in your code. In addition, many .png and .gif images can be compressed into smaller .jpg files and any transparent images that you have over a white background can have the transparency removed. By taking these steps, I usually cut my image sizes at least in half!
I was never using uncompressed images, so I don’t have a new page load time to share with you.
5. Cleanup code
This is one step that never ends. There is always more room for improvement in your code.
I constantly go through my theme’s files and remove 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. I do this on a constant basis with all of my PHP, CSS and JS files.
After the first time I cleaned up my code, my average page load time took 0.833 seconds.
In the end, five simple optimization techniques reduced my average page load time by 59%! Not bad at all.
Now, JWRmedia has a TON of additional features, images, flash and even video which never existed when I did these preliminary optimization steps. Even with all of this additional content, I have my average page load time down to about 0.419 seconds!
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. You won’t lose your visitors before they ever get a chance to see your content, and the search engines will love you for it as well!