Optimizations to reduce website loading time

后端 未结 14 1596
感情败类
感情败类 2020-12-07 16:12

What are some important optimizations that can be made to a website to reduce the loading time?

相关标签:
14条回答
  • 2020-12-07 16:41

    There are two sides you can care about, when optimizing :

    • The server side : what matters is generating the ouput faster
    • The client side : what matters is getting all that has to be displayed faster.

    Note : we, as developpers, often think about optimizing the server-side first... Which in most cases only represents less than 10% percent of the loading-time of the page !


    On the server side, you'll generally want to :

    • profile, to determine what's long
    • optimize your SQL queries, and reduce their number
    • use caching

    For more informations, you can take a look to the answer I gave some time ago to this question : Optimizing Kohana-based Websites for Speed and Scalability


    On the client side, the biggest gains are generally achieved by :

    • Reducing the number of HTTP requests -- the easiest way being to reduce the number of JS/CSS/images files, by combining several files into one
    • Compressing CSS/JS/HTML, using for instance Apache's mod_deflate.

    About that, there is a lot of great stuff on Yahoo's Exceptional Performance : they've released lots of good pratices and tools, such as yslow.

    0 讨论(0)
  • 2020-12-07 16:41

    The first optimisation is: Decide if it is slow, and if not, don't bother.

    This is trickier than it sounds, because it's not like testing a desktop app or game. A game is slow if when you play it on the target hardware, the frame rate is too low. This is very easy to measure.

    A web site is trickier, because you, as the developer, are probably using a local test system with a very fast network. Even when you use your staging / system test servers, you're probably still on the local network. Even your production servers are in all likelihood, on the same continent.

    The same is possibly not true for quite a lot of your users.

    Therefore the options which exist are:

    • Find out by asking your users, whether they find it to be slow
    • Simulate a high latency environment and test it yourself (or your QA team)
    • Guesswork

    The latter is not recommended.

    An option which the holier-than-thou Yahoo Web Sites performance book (which yes, is a book you can buy) doesn't mention a lot is HTTPS. Most web applications which handle important data run mostly or entirely over HTTPS, which changes the rules of the game rather a lot. Remember to do all testing with it enabled.

    0 讨论(0)
  • 2020-12-07 16:42

    install firebug and pagespeed plugin follows all the pagespeed directives (until possible) and be happy http://code.google.com/intl/it/speed/page-speed/

    anyway the most importante optimization in my experience is to reduce the number of HTTP requests to a minimum...

    0 讨论(0)
  • 2020-12-07 16:42

    Load balancing would help to reduce the loading time immense.

    0 讨论(0)
  • 2020-12-07 16:43

    i wrote some things about, see:

    Google page speed test optimization

    0 讨论(0)
  • 2020-12-07 16:50

    Here are a few "best practice" things:

    • Caching CSS, JavaScript, images, etc.
    • Minifying Javascript files.
    • gzip content.
    • Place links to JavaScript files, JavaScript code, and links to CSS files at the bottom of your page when possible.
    • Load only what is necessary.
    • For an existing website, before you do any of this determine where your bottlenecks are with tools like Firebug and as someone else mentioned YSlow (I highly recommend this tool).
    0 讨论(0)
提交回复
热议问题