views:

38

answers:

3

How to reduce load time from 10 secs to less than 1 sec?

+1  A: 

If your load time is > 10 seconds, then I would say the problems are all in your code. Chances are, it's your database access.

Look at the number of database queries you are executing, try to keep the number of queries to a minimum (especially don't query for the same thing over & over). The exact number you should aim for will depend on the kind of information the page is displaying - sometimes you can't avoid making queries.

Also, look at the time each query is taking. Inefficient use of indexes might not show up in testing (where you probably only have a relatively small number of rows) but in production (where you're probably got a lot more) you can bring your site to it's knees. Get to know your database's profiling tools.

Dean Harding
The question could very well be referring to a pure HTML page. "Load time" doesn't necessarily mean run time.
cHao
A: 
  1. Consolidate multiple css files into one and minify it
  2. Consolidate multiple js files into one and minify it
  3. Simplify your page if possible by reducing the number and complexity of controls
  4. Scrutinize any js that runs on load of the page and eliminate/delay what you can
  5. If you have many images displayed make them 1 image using something like this utility and reference the sprites
  6. Cache segments of the page or resources the page needs as much as you can
  7. Beyond that you've got to look at the app code (including db lookups), not the html code... In all reality you should look at the app code BEFORE you do any of the above.

    Good luck!

Tahbaza
A: 

I recommend downloading Firefox + Firebug + Yslow and then testing your website with those.

This will give you much of information on loading javascript, css, images and showing you where the problem lies and how to optimize everything :)

Example: alt text

Rakward