February 22, 2012

How to decrease loading time of a web page?

How to decrease loading time of a webpage?

This question mostly arise when we have completed a project and now not our clients but we the development team feels that web pages are taking much time in loading although problems can be our internet speed or sometimes hosting performance issue. It is rarely considered if ever development team took notice of client’s complaint regarding loading time of the website because a new born baby website rarely get traffic overnight after development. So to satisfy ourselves regarding decreasing loading time of a web page we have the following options:

Compare the loading time of landing page, home page and other identical web pages

Calculate loading time of all the website through a software of any free service available online

  1. Now check that which files are being included uselessly all over the website pages?
    Solution: Use if conditions and load only necessary files even scripts, images and styles.
  2. Do a little work on image manipulation and manage their sizes exactly which is required and compress them as well. It is not a wise act to consume much of bandwidth. Try to provide an efficient solution if you are not working on any Art/Graphics related website.
  3. Try to cache queries, if you are working in CI else try to reduce unions, joins, sub-queries and queries in view/foreach body etc.
  4. Cache images, styles, scripts according to their change frequency if project is underdevelopment/maintenance, but you can cache a no. of files forever e.g. jquery, json, swfobject, facebook relates files, prototype library files. Because these are required but you are not supposed to change in these files at all at least on intermediate level of development.
  5. Make sure that you are linking script files, style sheets and not including them as a PHP or any other script files which is being rendered on html page line by line and taking much time every time.
  6. Try to reduce CRUD operations on page load, if you feel that traffic is increasing rapidly and you need to log something so calculate the frequency of changes and write on disk with files. Then perform CRUD operations on those files instead of involving database transaction every-time.
  7. Now try to use .htaccess caching, which will finally do magic for you.
  8. Prefer to use iframes for advertisement which are either js script related or youtube players etc.
  9. Follow these steps in reverse manner to get a different result, sequence matters according to the situation.

Recommended Plugin:

Link: WP SpeedUp
Video Tutorial: Click here to watch

Last updated: August 23, 2015
Did it helped? One thought on “How to decrease loading time of a web page?
  1. Usman Zafar

    Here,you write awesome tips for developers who face this problem in every project.

Comments are closed.