Optimizations to reduce website loading time

后端 未结 14 1594
感情败类
感情败类 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:34

    Remove/Minimize any bottlenecks on the server side. For this purpose, use a profiler like Xdebug or Zend Debugger to find out where your application is doing expensive and slow operations. Implement caching where possible. Use an OpCode Cache. If this still isn't fast enough consider investing in more CPU or RAM or SSDs (depending on whether you are CPU, IO or Memory bound)

    For general server/client side optimizations, see the Yahoo YSlow! User Guide.

    It basically sums it up to:

    1. Minimize HTTP Requests
    2. Use a Content Delivery Network
    3. Add an Expires or a Cache-Control Header
    4. Gzip Components
    5. Put StyleSheets at the Top
    6. Put Scripts at the Bottom
    7. Avoid CSS Expressions
    8. Make JavaScript and CSS External
    9. Reduce DNS Lookups
    10. Minify JavaScript and CSS
    11. Avoid Redirects
    12. Remove Duplicate Scripts
    13. Configure ETags
    14. Make AJAX Cacheable
    15. Use GET for AJAX Requests
    16. Reduce the Number of DOM Elements
    17. No 404s
    18. Reduce Cookie Size
    19. Use Cookie-Free Domains for Components
    20. Avoid Filters
    21. Do Not Scale Images in HTML
    22. Make favicon.ico Small and Cacheable

    Also see the comments contributed below, as they contain some additional useful information for other users.

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

    We recently did this on our web site. Here we outlined nine techniques that seemed to have the highest impact with the least difficulty: http://mentormate.com/blog/easy-ways-speed-website-load-time/

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

    To reduce network traffic, you can minify static files, such as CSS and Javascript, and use gzip compression on generated content. You can also try using tools such as optipng to reduce the size of images.

    However, the first step to take is to actually analyse what's taking all of the time -- whether it's sending the bits over the network, or actually generate the content to send. There's no point making your CSS files 10% smaller if it takes a minute to generate each HTML page.

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

    Don't use whitespace in code.

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

    As already mentioned, you can use Yslow or PageSpeed firefox extension. But you can also use GTmetrix, an online service scanning your page with both tools.

    Features I like / use:

    • soft, clean and usable presention
    • comparison with another page. It's really interesting to see where are your friends / competitors.

    (by the way, i'm not related to gtmetrix !)

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

    The simple options I can think of are:

    1. Gzip (x)html, so a compressed file should arrive more quickly to the user
    2. minify the CSS
    3. minify the JS
    4. use caching where possible
    5. use a content-delivery network
    6. use a tool, such as yslow to identify bottlenecks and further suggestions
    0 讨论(0)
提交回复
热议问题