HTML and JavaScript performance

I have a website that is slow. The server responds for approximately 2 - 300 ms with each request, but it takes 1.5 - 2 seconds to view the page.

While experimenting with disabling javascript and CSS, I decided that this was browser processing, which took up most of the time.

Using Firebug, I see that the DOMContentLoaded event seems to fire about 0.5-1 second after receiving data from the server, and the "load" event fires in the second half of a second.

Using the Firebug profiler, I see that javascript takes about 250 ms to complete.

So my questions are:

  • What does the browser do in the remaining time when it takes 250 ms to execute Javascript, but it takes a second before the page is ready?
  • What happens between DOMContentLoaded and load events
  • What would be the best approach for me - optimizing the client side of such a page?
+3
source share
4 answers

Not only loading, but also rendering pages takes time.

There are many things you can do to optimize performance, you can use tools like YSlow and PageSpeed , to further analyze the page and determine what can be done.

See also the rules Steve Suders outlined in his book High Performance Web Sites:

  • Make fewer HTTP requests
  • Using Content Delivery Network
  • Add Expires Header
  • Gzip
  • CSS-
  • JavaScript CSS
  • DNS
  • JavaScript
  • ETags
  • AJAX Cacheable

-. , blog.

Yahoo -.

+3

. , . ,

  • HTTP-. javascript , css (. spriteme)
  • . minify gzip . content-expires, .
  • CDN, , google, , jQuery, google. , .
  • javascript . script. css , javascript . , , DOMReady

DOMReady , ( ), , , javascrpit.

YSlow Firebug.

0

, Javascript ... DOM. , .

, - JS-.

Closure javascript..., inc .

google closure compiler - js.

0

Source: https://habr.com/ru/post/1724267/


All Articles