While running the lighthouse audit in chrome developer tools, I received the following report for javascript execution. I Found out that the main.js is taking a lot of time in Script Evaluation (455 ms) as compared to Script Parse (5 ms). But I am unable to figure out what is this Script Evaluation time? Is it the time taken to download the script? How can I reduce it?
According the following Lighthouse reference https://web.dev/bootup-time/, there are four main costs to execute any JS file:
Parse and compile cost: JavaScript gets parsed and compiled on the main thread. When the main thread is busy, the page can't respond to user input.
Execution cost: JavaScript is also executed on the main thread. If your page runs a lot of code before it's really needed, that also delays your Time To Interactive, which is one of the key metrics related to how users perceive your page speed.
Memory cost
I believe the evaluation time in Lighthouse terminology is the time after parsing the script to load the whole file in memory. In other words you have to check the heavy file and try to optimize the code in the file itself. Here are some facts I learned from studying the same problem you are checking:
The solution could be to split the file into two files, one is the critical file which should be loaded initially and the other one could be deferred to optimize the performance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With