Search code examples
performancequery-performancelighthouse

Lighthouse audit: JS reduce execution time


Thanks lots in advance. In google's lighthouse report, there's a section called "Reduce JavaScript execution time".

In this section, there are few scripts like jquery.min.js w/ associated "Total CPU Time", "Script Evaluation", "Script Parse" columns.

In this section, there's also the page (for which I was running the report): www.abc.com/cards/

What javascript is this referring to and how can I reduce the "Total CPU Time", "Script Evaluation", "Script Parse" values.

Thanks again.


Solution

  • This is an over simplified explanation as there are loads of idiosyncrasies in how JavaScript runs in the browser but it should give a decent idea.

    Script parse time is the time it takes for the browser to read the whole file and "understand" what is in it ready for the compilation / evaluation part

    Script evaluation time is the time taken between parsing the script and loading the script into memory / executing the script. This is where the browser attempts to optimise code ready for execution.

    Total CPU time is the total CPU time (on the main thread) that the script used including parsing, evaluation, compiling and running any functions.