Bootup

JavaScript Execution Time: how to reduce it

Speed performance

JavaScript Execution Time: how to reduce it

There are various factors that are affected by the loading of the JavaScript code execution, slowing down the performance of the page:

Parse and compile

Due to the fact that the JavaScript code is parsed and compiled on the main thread, when this is full of work the page is unable to respond to user interactions.

Execution

JavaScript code is always executed by the main thread, so if the page processes too much code before it is actually needed this can affect your Time To Interactive as well.

Memory

When JavaScript code holds many references, it is possible for it to consume significant amounts of memory: when this happens, pages look different or slower. In addition, this may cause the page to freeze completely.

Network

Download time is affected by the number of bytes.

How the SeoChecker JavaScript execution time audit fails

If JavaScript execution lasts more than 2 seconds, SeoChecker will display a warning; if the execution lasts more than 3.5 seconds, instead, the audit will fail.

In the table below you'll see an example of SeoChecker report, that gives you information about the time spent executing, evaluating and analyzing every JavaScript file in your page.

bootup

 

How can I make JavaScript execution faster?

  • minify and compress the code;
  • if there is unused code, remove it;
  • with the PRPL pattern you can cache your code reducing network trips;
  • implement code splitting sending only the code needed by your users.

Share this Guide

Did you like it? Share it!

Share this tool

Web tools for modern developers. Try these one!

Over 50 generators, builders and validators to improve your SEO and web performances

Home Back to top of the page