Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how google lighthouse calculates javascript evaluation time and why it varies by a huge margin for same scripts on different environments

I'm working on improving the performance scores of a website. On running lighthouse in Reduce JavaScript execution time under diagnostics, I see high Script Evaluation time for few of my js scripts.

If I run lighthouse on different environment I get different evaluation time for the same scripts, this difference is very large for instance for one script it changes from 1700ms to 100ms,

I wanted to understand how lighthouse calculates the evaluation time, so I can work on reducing it.

Those js files are comparatively smaller than other files having lower evaluation time, which I'm unable to understand. If it matters, in profiling I can see that execution time of the same script is 45ms.

PS- I know that script execution and evaluation are different

Thanks any help would be much appreciated.

like image 236
Anand Bhushan Avatar asked Oct 17 '25 02:10

Anand Bhushan


1 Answers

Lighthouse scores are always different in different tests as well as devices and it depends on the time of parsing the file as well as executing, how many memory it uses together with the network cost. These details are properly documented by the officials.

The evaluation time is where the parsing and execution happens.

If you have small files as you mentioned, you can check if there are any render blocking codes or other synchronous actions that usually takes long time.

Even your profiling test results in small time complexity for execution, maybe it can be a network cost or the memory? You can verify it through the network tab or check how much memory it can allocate.

The script evaluation is actually the script that are needed for the page to run on the go.

So, the best way will be to determine what are the scripts needed for your page to run on initial load and optimize only those part of the scripts. If it includes the synchronous actions then they can be the major issues.

One thing to note is, if you have code that are unused, they are not evaluated so you can filter only the code that are needed without worrying about the unused codes.

Anyways, the lighthouse score are really unpredictable most of the time.

You can check below sources for more detail information:

Boot Up time for script

About performance scoring overall

like image 193
Ashish Yadav Avatar answered Oct 19 '25 14:10

Ashish Yadav



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!