English subtitles

← Optimizing the DOM - Website Performance Optimization

Get Embed Code
6 Languages

Showing Revision 5 created 05/25/2016 by Udacity Robot.

  2. >> All right. Now we're on to the fun stuff. Can we start optimizing now?
  3. >> Yep. Let's just focus on the steps before
  4. the render tree construction, so, the DOM and CSSOM,
  5. because those are usually the steps that are the
  6. worst offenders and make your page. Render very slowly.
  7. >> Well, we did talk about streaming HTML to the client as fast
  8. as possible so the browser can start building the DOM. Is there anything else?
  9. >> So that's definitely one. What about the size of the HTML?
  10. >> Hm. Well, I'm going to go ahead and
  11. guess we should keep it as small as possible.
  12. >> Yep. That's another good one. Let's take
  13. a look at some strategies that will help us
  14. with this. Let's say we want to optimize the HTML file in front of us. The first
  15. thing to notice is that we have CSS
  16. comments, HTML comments, and JavaScript comments. Now, these comments
  17. are very helpful for developers. But guess what
  18. the browser's going to do when it encounters them.
  19. >> It's going to ignore them.
  20. >> Exactly. There's no point in even shipping them to the browser. We can
  21. minify the file and reduce its size.
  22. To learn more about minification check the link
  23. in the instructor notes. Once you've done that you should also compress the file
  24. and make sure they are cached by
  25. the browser. Once again, check the instructor notes.