Speed Up Your Website Loading Time

SpeedDo you own a website or blog? How fast does it load? Do you think that your site’s speed may be affecting the number of visitors you get? It just might.

You may have been aware that Google has recently announced that a site’s performance will now be calculated into the Page Rank formula in a new Webmaster Tools blog post.

Google Site Speed

Google Webmaster Tools features Site Performance information, which provides suggestions on how to speed up your website. So let’s start speeding up websites and not only make Google happy, but your visitors as well.

Limit DNS Lookups

Whenever a new domain or subdomain is requested, the domain must be looked up for DNS information, which allows the browser to connect to the domain’s IP address at the server that it is hosted on. Many lookups can delay page speed and it’s best to serve all resources locally when possible.

If you are embedding an image from another site, why not save it onto your own server and host it from there? “Another site” refers to subdomains as well since they have their own DNS information. If your site is blog.techairlines.com, techairlines.com requires another DNS lookup (and vice versa).

I recommend only having additional DNS lookups when necessary such as using a site analytics script (Google Analytics, WordPress.com Stats, etc…) or an ad server (like Google Adsense).

Serve URLs From A Consistent URL

Browsers cache files on the local system so it does not have to be redownloaded next time the user visits that same page or file. Unfortunately, if the same file is loaded from many different URLs, the browser does not know they’re the same, and therefore will not load from the cache.

Loading from cache allows the client to load the page quicker as well as saving your server bandwidth.

This applies to all files including images, CSS, and scripts.

Firebug Network

Combine External CSS and Javascript

Why have multiple CSS stylesheets? Combine them into one to minimize the number of browser requests by as much as possible. Requesting another URL takes additional time and when it comes to website speed, every millisecond counts.

Many pre-made website templates have multiple CSS files to allow easier editing and finding of each element, however this isn’t necessary as we have a Find and Replace feature these days. So combine the style.css, print.css, and ie-fix.css into one single style.css.

Avoid Unnecessary PHP Queries

Remove any unnecessary PHP queries as well as all other server side programming languages. This is most commonly found in CMS platforms such as WordPress. A guide to doing this can be found here.

Move All Javascript to the Footer

Javascript restricts in-line page loading, which means that when the Javascript is being loaded, the rest of the page cannot load, so a browser that’s slow in rendering scripts will load the entire page slowly. Moving scripts to the footer can significantly improve page loading speeds.

Simply cut and paste all scripts from the head section of your HTML and place it right before the closing body tag.

To do this in WordPress, simply add the following lines to your theme’s functions.php file and all scripts that are injected properly into WordPress’s head section will be moved to the footer.

// Move All Javascript to Footer
<?php
remove_action('wp_head', 'wp_print_scripts');
remove_action('wp_head', 'wp_print_head_scripts', 9);
remove_action('wp_head', 'wp_enqueue_scripts', 1);
add_action('wp_footer', 'wp_print_scripts', 5);
add_action('wp_footer', 'wp_enqueue_scripts', 5);
add_action('wp_footer', 'wp_print_head_scripts', 5);
?>

Enable Server Side Compression (Advanced)

Note: Page compression often uses quite a significant amount of CPU power therefore is not recommended on shared hosting configurations as your host will likely suspend you for high resource consumption.

Gzip Turned Off

Browser request with compression off. (Credit: Google)

Compression is exactly what the name implies. Pages are compressed before sending it to the user. When the client requests the URL, the server would then compress the file, and send the client’s system a compressed version of hte page. The client’s browser will be uncompress it and display the page. This not only speeds up page loads but can save significant amounts of server bandwidth. As a trade off, compression consumes extra CPU power.

Gzip Turned On

Browser request with compression on. (Credit: Google)

A simple way to enable this is to add the following lines to your root .htaccess file (for Apache servers supporting .htaccess):

# compress all text & html:
AddOutputFilterByType DEFLATE text/html text/plain text/xml

Another method would be this:

# Compress certain file types by extension:
<Files *.html>
SetOutputFilter DEFLATE
</Files>

This turns on Apache mod_deflate and would compress all HTML files before sending it to the client computer. There are also other methods including Gzip Compression.

If the browser the client is using does not support un-compression, the server should recognize that and the page will then just be served normally.

To check if this is working, check HTTP headers using tools like Firebug or HTTP Header Check to check the HTTP Headers of the page for Deflate, Gzip, etc..

Every millisecond of a site’s loading time is important and its crucial to limit the time it takes for a client to load your website as much as possible. This can also increase the chances of the client staying around your site longer and reading your content rather than waiting for the pages to load. Page speeds now count for about 1 percent of your Google PageRank, which might not be much but a very slow website could make a big difference.

Do you have additional suggestions for speeding up websites? Share them in the comments.

Brian
Brian is the founder and editor-in-chief at TechAirlines.

2 Responses to “Speed Up Your Website Loading Time”

  1. Creastery says:

    Nice guide to help out everyone who wish to make a website with lots of data to load.

  2. Jessica says:

    You know Brian, I actually wrote about this subject today on my own blog. This article has really given me some food for thought and I think you make lots of really interesting points. I wish I had seen it before I wrote my own post!
    Many thanks, sparky13.

Leave a Reply

This site is DoFollow. Post at least 3 comments anywhere on the site OR comment as a registered and logged-in user and all your comments will have the NoFollow attribute removed. Please use a real name or nickname when commenting, not keywords. Check the Commenting FAQ.

Copyright © 2009-2010 TechAirlines. All Rights Reserved.