Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yes, JavaScript size is still a performance concern if it is cached for the following reasons:</p> <ul> <li>Most browsers don't cache the byte code that they execute. So the script must still be re-parsed on every page load. Modern browsers are doing this faster, but it still may be a concern for very large JavaScript files.</li> <li>The code in your JavaScript files is actually executed on every page load. Even if browsers start caching byte code, they still have to re-execute the JavaScript every time the page is loaded.</li> <li>You may get a lower cache rate than expected, for reasons beyond your control. Users may disable their cache, or visit so many sites that your files get expired from the cache quickly. You should check your logs to make sure that the ratio of page loads to JavaScript file loads is high.</li> <li>Loading a file from cache is usually pretty fast, but it's not always trivial. It can take upwards of 200ms in some cases.</li> </ul> <p>You can do a pretty quick test to get a rough idea of how long your scripts take to parse and execute like this:</p> <pre><code>&lt;script&gt; var startTime = (new Date()).getTime(); &lt;/script&gt; &lt;script src="cachedFile1.js"&gt;&lt;/script&gt; &lt;script src="cachedFile2.js"&gt;&lt;/script&gt; &lt;!--all your scripts included this way--&gt; &lt;script&gt; var endTime = (new Date()).getTime(); alert("Took " + (endTime - startTime) + " milliseconds to parse and execute"); &lt;/script&gt; </code></pre> <p>Make sure to test on all the target browsers you support; JavaScript parse and execution time can vary wildly between different browsers. Also make sure that you test on a computer that is as slow as the ones your users will have. If you do find performance problems, you probably will need to solve them in a profiler. Minification won't help much for improving parse and execution time.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload