Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimizations to reduce website loading time

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

like image 624
Josh Curren Avatar asked Mar 01 '10 22:03

Josh Curren


People also ask

Is there a way to decrease the load time of a web application?

But there are a few ways to reduce this without changing the code. Minify the code with a tool like Closure Compiler, JSMin, or Uglify. Minification reduces the code size without compromising any of its functionality. Compress JavaScript assets in transmission with HTTP transfer encoding such as brotli or gzip.

How do you reduce DomContentLoaded time?

To speed up DomContentLoaded , you can do a few things: Make script tags async where possible. Moving script tags to the end of the document doesn't help speed up DomContentLoaded , as the browser must still evaluate the Javascript before completing the construction of the DOM.

What affects loading time of website?

There are many different factors that affect page load time. The speed at which a page loads depends on the hosting server, amount of bandwidth in transit, and web page design – as well as the number, type, and weight of elements on the page. Other factors include user location, device, and browser type.


1 Answers

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.

like image 101
Gordon Avatar answered Nov 15 '22 16:11

Gordon