Improving Performance

Response time plays a key role in how users perceive your application; nobody likes a slow application. By tracking your application's usage and adjusting its performance, you can dramatically improve the quality of your application's user experience.

There are two approaches to improving your application's performance. First, you can improve the actual response time by optimizing the application logic. Second, you can enhance the perceived performance by adjusting the order in which you load resources.

The following guidelines discuss both approaches:

Do's

  • Use YQL to cache queries. Combine multiple queries into one call.
  • Use unique URLs for resources such as images or media files. When you update the content of a resource, you should update the URL so that the cache is flushed with the updated content.
  • Write modular code and reuse it as much as possible. Reuse is especially important because Caja, the technology used by Yahoo! to ensure the security of user data, can increase the size of your JavaScript code by 2-3 times because it adds a series of checks and verification steps.
  • To improve perceived response time, defer loading resources until your application has launched. Also, load resources after fully rendering the page.
  • Present a progress indicator while resources are being loaded.
  • Monitor the response time of your server. If your application takes more than 9 seconds to load, YAP displays an error message to the user. If an image request takes longer than 3 seconds, the request is terminated and the image will not be available for your application.

Don'ts

  • Don't use multiple, sequential calls if they can be combined into a single call.
  • Don't overload your front-end with unnecessary JavaScript code if the same functionality can be achieved in the back-end.

Image Caching

YAP caches images from third-party servers, usually for a day or so. You can control this behavior by including the standard Cache-Control header in your HTTP responses.

Table of Contents