Chapter 9. Performance

 

This chapter covers

  • Minimizing initial payload
  • Reducing network requests
  • Minimizing impact on the publisher’s page
  • Controlling expensive JavaScript calls
  • Improving perceived performance

At this point, you’ve learned almost everything you need to know about building a third-party JavaScript application. You know how to distribute your code, render safely on the publisher’s page, establish communication channels, and even provide a suite of client-side functionalities through a JavaScript SDK. You’re also familiar with the common security threats you might encounter when your application is exposed to the public. Now that we’ve covered the fundamentals, we’ll discuss how to make your third-party application fast.

Performance is an extremely important topic. Companies with high traffic applications save millions of dollars by tweaking and optimizing their performance. Google, for example, found out that a one-half-second delay in returning a search results page damaged user satisfaction, resulting in a 20% drop in traffic. And for a company that generates 95% of its profits from advertising, a 20% drop in traffic meant millions of dollars in lost revenue. Amazon did a similar experiment as well, and found out that even very small delays—increments of 100 milliseconds—resulted in a significant drop in revenue (see http://mng.bz/73U0).

9.1. Optimizing payload

9.2. Optimizing JavaScript

9.3. Perceived performance

9.4. Summary