Skip to Main Content

2020 eCommerce 3rd Party Technology Index – Click Here to Read the Report

3rd Parties

Why Your Website Is Slow: Poor JavaScript Performance

“Why is my website is slow?” Poor JavaScript performance – hosted and third party – could be the problem. Here’s how to find out if it’s ailing you and your website visitors!

Get your free eCommerce Site Performance Snapshot to learn how JavaScript is impacting your site performance today!

JavaScript is the reason we’re able to collect information on our website visitors, engage visitors through social media, and offer dynamic web experiences instead of plain old text and images. Unfortunately, it’s also one reason webpages rarely load as fast as visitors expect them to.  

The spread of JavaScript on web pages is directly linked to an explosion in the weight of web content. Today the average webpage is 13 times heavier than it was in 2002, and nearly 20% of that average page is composed of JavaScript. The language offers the ability to collect important info and provide an engaging user experience, but is too often implemented with little regard for performance cost. Since it’s a major cause of website performance issues, we consider JavaScript to be one of the best places to start when looking for ways to speed up your website. 

How Do I Know if JavaScript Performance is a Problem?

To find out if JavaScript is slowing down your website, run a JavaScript performance test at  Just plug in the URL for your home page and hit “Test” – that simple!  You can also run separate tests for any other highly trafficked (or otherwise important) pages, such as a catalog page on an eCommerce site.  The results will tell you a lot about your website – including information on each of the JavaScript files on your page. 

What to Look for in JavaScript Performance Test Results

The simplest stats to look for are the total weight and number of JavaScript.  Look to the “Content Complexity” section of the results summary page for these stats.  In general, any additional weight (meaning: more bytes, bigger files) adds to the page load time, and likewise additional assets add time even if they’re really lightweight (meaning: less bytes, smaller files). A round trip to the server takes time even if the file it fetches is 0 bytes.  Basically, when it comes to JavaScript files, the lighter and fewer the better.


Why Your Website Is Slow - Poor JavaScript Performance


Update 8/3/2015: The use of Javascript has continued to grow enormously in the past two years, so we’ve adjusted the figures here to reflect more current web averages.

Some context: across the web, the median number of JavaScript on a page is 8 21, and the median weight of those files is 111 352 kB.

  • If your site’s JavaScript totals are around the median, you will absolutely benefit from JavaScript optimization, but there could be other bottlenecks doing more to slow down your site.
  • If your numbers are higher than the median, optimizing JavaScript should be a priority.  It’s probably slowing down your site considerably.
  • If have 45 or more JavaScript files (or 600 kb or greater weight) you’re in the dubious company of the bottom 10 percent of all sites on the web for JavaScript.  If this is the case, optimizing your JavaScript will vastly improve your page load time

A Deeper Dive: Reading the JavaScript Waterfall Chart

Beyond the aggregate statistics, it’s worth taking the time to look at the waterfall chart in your results page.  The waterfall is a timeline of the page’s load process, and provides insight down to the individual asset (in this case, the individual JavaScript file). 

Looking at the waterfall, click the column header “Type” and choose JavaScript from the dropdown menu.  This will isolate JavaScript files from the rest of the files on that page.  (If “x-JavaScript” files exist on the page, you’ll have to look at these files also in order to get a complete view; x-JavaScript is an obsolete header call but is still fairly common.)


JavaScript Waterfall Chart - Why your website is slow
Among the files in the waterfall, look for any that stick out with a long time to load.  Most JavaScript files load in less than 100 milliseconds.  Any more 200 ms load time (see below) is a major red flag.  If you find a slow JavaScript file that is hosted on your site (rather than from a third party) then you can take steps to compress and minify the JavaScript to make it load faster. 


Javascript Performance Waterfall Example
Another trait to look for is what we call a “chatty” asset.  That means for one widget or other piece of content, several assets must fire off in a row to load it.  That’s simply inefficient. If possible, you should find a different version of whatever widget is chatting too much.


Javascript waterfall load script example


Does Optimizing JavaScript Performance Really Work?

Yes, JavaScript performance optimization works. A lot has been written about it around the web. Beyond that, we created an experiment to isolate JavaScript optimization from the many other content optimization techniques.  We found we could shave a site’s load time down by 33% with just JavaScript concatenation and minification – that’s 1/3 improvement on top of all the other techniques for images, HTML and others.  


Optimizing JavaScript performance chart

Special Note Regarding Third Party JavaScript

A JavaScript served by a third party is a horse of a different color.  Third party JavaScripts are some of the worst performance offenders. We’ve written specifically on the 12 worst 3rd party JavaScript offenders and how Facebook took down the web with its JS files.  These issues are largely separate from the issues we’ve identified above – they have to do with the reliability of the delivery of the asset.

The root of the problem with third party JavaScripts is that web performance issues from the originating site can spill onto your site through the script.  Particularly problematic are third party JavaScripts that load synchronously, which means they might include a blocking behavior as they execute and hold up other assets on your site until it’s done.  If that JavaScript happens to have an issue with its delivery, a large portion of your site could be waiting for seconds and seconds, waiting for one script to finish.  Making sure your third party JavaScripts load asynchronously is a good way to prevent the blocking behavior.  Even more effective: simply be judicious about which third party JavaScripts you allow on your website.  

Yottaa’s web performance optimization software automatically optimizes the JavaScript on your ecommerce website, as well as other critical elements of ecommerce performance optimization. Request a free assessment here.

Don’t let slow site performance cost you conversions.Let's Talk