Improve page loading time
October 22, 2010 § Leave a comment
Now a days the speed of internet is growing like the price of gold in India. Up to 16Mbps is getting for homely use only. So a normal user expects the website he wish to browse to be loaded in less than 2 seconds. If takes more than 3 seconds he will saus “hmm”, then if we pass 5”seconds” then it will be “aarg” and beyond that “damn it, I don’t want to waste my time by browsing this dead slow website” at the end losses the visitor.
So to compete in this real internet world we have to give high quality products. Is that only ..? No we have the responsibility to save the time of the visitor. Understand the fact that every one is busy, so consider the tight schedule of the end user and give appropriate solution.
In this topic I am trying to cover some points which can improve the page loading time of a website.
The points mentioned below are a just a light in the darkness, you have to find your pin.
Below are some basic things you have to consider while developing HTML:
- W3C validation
- Try to load only one js file and one css file
- Compress css and JS file
- Try to avoid including of js files inside the body part
- Avoid complex nesting of tables
- Try to follow div layout ( avoid tables )
- Reduce the size of html files ( the one which we will see in view source )
- Use CSS sprites
- Reduce the number of requests send to the server to load DOM items
- Reduce image quality to a medium level, do not use HD videos or Multiple HQ images to load in same page
Things you have to consider while developing Server Side :
- Try to reduce the number of database queries.
- Analyse the flow of a particular page. Identify which data needed to be taken from the DB. Try for the possibility of writing a single join query to retrieve all the data. If it is no way possible then create multiple queries.
- Optimize database
- Increase the usage of SQL Views ( If a page with complex join query have frequent hits on it, convert it to view )
- Try SQL Caching
- Enable content caching through your server side script
- If you have multiple unavoidable imaged needed to be loaded, use CDN ( content delivery network ).
- Make sure you are DRY in code ( Do not Repeat Yourself )
- Try to follow a templating system ( small application) or framework ( medium – large application)
- Use Gzip Compression