Is Your Website Unnecessarily Slow?

This article was originally written for ArrowQuick Solutions, a technology consultancy for small businesses.

Posted on February 9, 2011

A lot of sites nowadays use JavaScript — programming code that runs in your browser — for extra interaction, animations, and other functionality. The problem is, if not done correctly your website will pause while it loads the Javascript. This is bad, because visitors won’t wait around for a slow website.

If you’ve delved into the guts of your website, you may have used Javascript code before. Those little bits of 3rd-party code like Google ads, Google Analytics and other trackers, interaction and animation libraries, live chat agents, and other marketing tools are embedded on your site using Javascript.

First, take an inventory of what you’re including. For example, Apple’s website loads 12 separate Javascript files on the homepage alone — 3 standard libraries, 2 for tracking and metrics, and 7 for specific site functionality. At the very least, those 7 files could be combined into one single file. AllMusic.com is even worse, with 3 standard libraries, 1 file for site functionality, 4 for tracking, and 4 for ads. Each of these files requires another roundtrip between the visitor’s computer and the web server. Be judicious in what you include on your site — there’s a trade-off between features and speed.

Let’s assume you need all these files, and they’ve been combined into the fewest number of files possible. The way Javascript code is traditionally added to a page means that it is synchronous or blocking — that is, none of the content on your webpage is displayed until all Javascript code is loaded. Now, if the visitor has a fast connection, the delay will less than a second. But if your site has a lot of Javascript code, or the visitor is on a slower connection, this can take much longer, and by that time the visitor will have left. By making the Javascript asynchronous or deferred, the code will load in the background or after the content is displayed.

By making these simple changes, your website will feel much more responsive to visitors. And none of the underlying functionality needs to change.

Leave a Reply

  1.  

    |