Improve your websites first load performance

If you are a serious webdeveloper the chances are good that you are already using one of the famous javascript-libraries like jQuery, Prototype/script.aculo.us, MooTools, YUI or others. These libraries can be a big part of the content that needs to be send to the visitor of your website. This however don’t need to be the case as long as the site is not limit to a companies intranet.

So if you are using a piece of code like the following:

<script type="text/javascript" src="/js/jQuery.min.js"></script>

consider using the Google AJAX Libraries like this instead:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>

Doing so, you are reaping 4 benefits (decreased latency, increased parallelism, better caching and less traffic) from it:

Decreased Latency:
By using the CDN (Content Delivery Network) of google you make sure that the visitor downloads the script from the closed available server belonging to google. Therefore the download might be faster and the response time shorter.

Increased parallelism:
Browsers limit the number of simultaneous connections per hostname. Depending on the browser, this limit is usually 2 or with newer browsers 6. This means for some users that while downloading 2 scripts, images, or stylesheets from your server they still can download the javascript library of your choice from google. In some cases the difference is noticeable.

Better caching:
Probably the greatest benefit of using a CDN like e.g. the Google AJAX Libraries is that your visitors may not need to download jQuery at all even on the first visit. If the visitor have ever surfed an website also using the Google AJAX Libraries, it’s highly likely that it’s already in the browsers cache. This is also a big benefit for the user, since he/she doesn’t need to have dozens of identical copies of jQuery in their browser’s cache. Also the caching is optimally configured and browser can cache the file for up to one year.

Less Traffic:
For smaller websites another benefits might be that less of the valuable traffic is actually send on sending “website internals” to the visitor. Nothing send, nothing paid.

Advertisements