Speed Up Your Website

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:

Load time:

The average page load time before I did any optimization was 2.138 seconds.

1. Cache objects
The first time a person visits your site, the page requested may have to make many HTTP requests for stylesheets, javascript, images, flash, etc. By instructing your site to cache certain objects, a browser will only have to load these objects once. Subsequent page views 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:

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.

2. Merge all stylesheets & javascript
Speed Up Your WebsiteIt’s a proven fact that a browser will load one large stylesheet much faster than multiple smaller stylesheets. The same goes for javascript files. I took all the stylesheets from my theme, WordPress and all of the plugins I’m using and squished them all into one larger stylesheet. I did the same with my javascript files. I do have a few .css and .js files I’ve kept separate that only have components that are needed on a few pages of this site, so they only load when needed.

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!

2 thoughts on “Speed Up Your Website

  1. Great tips! I agree with having to grab your readers attention quickly and slow sites are a big turn-off.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>