Wednesday, June 4, 2008

Boost up your site load time

This article by Drunkadmin had hit the front pages of Digg. It gives a good idea on optimizing web pages that will definitely increase a website's loading time.

Host Images And Files Somewhere Else
Many users online at the same time can cause your server to handle a lot of requests. Its best that if you are using images in your site, make sure you upload them to image host sites like ImageShack. This will greatly reduce the bandwidth used by your server and also make your blog faster as image upload sites have a better speed.
Best place to host files of sizes 2-5mb (Any thing you need to provide users for download) is to use Google Pages as your host.
Optimize Your CSS
Nowadays many sites have started to use CSS based formatting. Even if Style Sheets are naturally more efficient than HTML tables you can still optimize the CSS code to make your website cleaner and faster. Having a clean CSS can reduce the time taken by the clients browser to decode your site.
Manual Clean

Try to locate dispersed code and aggregate it together.
For example instead of

margin-top: 20px;
margin-right: 10px;
margin-bottom: 20px;
margin-left: 10px;


margin: 20px 10px 20px 10px;

You can use the tool Clean CSS to optimize your CSS and remove useless property declaration and whitespaces.

Optimize Your Images
Use image formats such as PNG, JPG,/JPEG And GIF. Always use the “Save for web” image quality which is available in most softwares such as Adobe Photoshop.
Use Height/Width Tag In Images
Most people dont add hieght and width tag to images. These tags make sure that the browser knows the dimensions of images before it has completed downloading the image. If the browser does not see those tags it will need to figure the size of the image, then load the image and then load the rest of the page.
When the height and width tags are included the browser will automatically know the size of the image. As a consequence it will be able to hold a place for the image and load the rest of the page simultaneously. Apart from the improvement on the load time of the page this method is also more user friendly since the visitor can start reading the text or other information while the image is being downloaded.

Use Less Javascript!
Some people tend to add a lot of javascript effects to their site. Using excessive javascript animations may cause clients browser to freeze for some time annoying the user.

  • Optimize Links
    Make sure that the outlinks from your blog and link between posts are optimized well. For example if link is make sure you write it as to prevent one extra request which would be made to the server if the former link is used.
    The improvement on the loading time of links ending with a slash will not be astronomical, but when it comes to speeding up a website every small bit helps!
  • Reduce HTTP Requests To Server
    When opening a web page every object (images, scripts and the line) will require a round trip to the server. This latency can add several seconds to the load time of your site. Make sure to reduce the number of objects and to combine CSS files and scripts together.