Approach 2: Loading JavaScript more quickly

The second approach is to simply spend less time loading the same JavaScript, so that visitors spend less time waiting for the page to render. There are a number of ways to achieve just that:

  • Techniques used with images, such as caching and parallel download
  • Free Content Delivery Networks
  • GZIP compression
  • Minification
  • Combining or breaking up JavaScript files
  • Removing unused code

Techniques used with images

JavaScript files are static files, just like images and CSS files. This means that many techniques that apply to images apply to JavaScript files as well, including the use of cookie-free domains, caching, and boosting parallel loading. You'll find out more about these techniques in Chapter 12,Reducing Image ...

Get ASP.NET Site Performance Secrets now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.