Performance of jQuery Tools

A key design facet of jQuery Tools, as outlined by Yahoo's five rules of best practice, is that designers should try to reduce the number of images, stylesheets, and scripts that have to be downloaded. Yahoo argues that this is the key to improving the speed of your site, as most of the time spent looking at a site is from the front-end. The five rules created by Yahoo!, and to which jQuery Tools adheres, are:

  1. Reduce the number of HTTP requests.
  2. Use a CDN link, for incorporating scripts into your code where possible.
  3. Add an expires header.
  4. GZIP components where possible.
  5. Minimize the JavaScript by compressing the code.

If you include the following script link in your code, you will be able to respect these five rules:

<script src="http://cdn.jquerytools.org/1.2.6/jquery.tools.min.js">
</script>

They can help to improve the performance of your site significantly and improve your website performance roughly by 70 to 80 percent! You are encouraged to use the CDN links that are made available, especially for production use; if you are concerned about the file size you should download a combined script that contains only those tools that you really need and follow the principles that are mentioned in this chapter.

Reduce the number of HTTP requests

A good practice is to minimize the number of separate JavaScript or CSS files used in a site—this helps to reduce the amount of time taken to fetch content from different sources. This is allowed for within jQuery Tools, which uses one combined JavaScript file when either downloading a custom build of the library, or using the CDN links.

jQuery Tools are available through CDN

There are a number of CDN links that are available for use—using these can result in a 15 to 20 percent increase in efficiency, in comparison to using manual, static links.

Adding an expires header

JQuery Tools are built with expires headers set on all of the tools, which makes them cacheable; this will reduce subsequent response times from each visit to a site by as much as 50 percent.

GZIP components

If gzipping has been enabled on a server, then this can help cut file sizes by as much as 65 percent; most modern browsers claim to be able to handle gzipping, when it has been enabled on a server. All jQuery Tools downloads available through the CDN links are gzipped, to help reduce download times.

Minifying JavaScript

jQuery Tools scripts are minified using Google Closure Compiler to reduce the file sizes and increase performance, as this yields a higher compression ratio than simply packing the same files.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset