FAQ
URL
https://jsbin.com/rosesuluyi/9/edit?html,js,console
What happened?
tldr; It seems the Main Thread Blocking Time and the Long Main Thread Tasks duration don't correctly add up for external scripts.
I've learned the following definitions of the terms:
A Long Tasks is a task that takes longer that 50ms to complete. The part of the task that is longer than 50ms is called the 'blocking time'. If this is happening on the Main Thread, this is called "Main Thread Blocking Time".
This is not to be confused with Total Blocking Time (which isn't total at all, but the sum between FCP and TTI).
e.g. a task takes 250ms to complete will be a Long Task, and has a blocking time of 200ms.
I am trying to use lighthouse to asses the performance of a third-party script on a page.
Lighthouse outputs information about the Main-Thread Blocking Time in the "Reduce the impact of third-party code" category, and information about the Long Tasks in the "Avoid long main-thread tasks" section.
Given the above formula, I would have expected the sum of Long Tasks for a specific script - 50 * (amount) would be equal to the reported Main Thread Blocking Time.
However I did notice that the numbers were not matching.
On our real testpages, which I cannot disclose, the difference is bigger than on the sample page above. Possible also related to a lot more code running on the pages from different sources. If truly required I can see about setting up such a page for public.
What did you expect?
I would have expected the numbers to add up.
So that I could take the Total long task duration and the number of long tasks and use it to calculate the Main Thread Blocking time.
What have you tried?
I understand at some points lists are truncated to 20 entries, and because of that, it might be possible that the total numbers don't add up. But in this case there are always less than 20 entries.
I was also thinking that maybe lighthouse would do different passes to calculate the different data, and the data not matching being caused by variance, but as far as I can see, lighthouse only performs one pass.
To setup this linked test I managed to reproduce the behavior in Chrome Devtools, but I originally found the issue in Lighthouse-ci / cli
How were you running Lighthouse?
CLI, Chrome DevTools
Lighthouse Version
10.1.0
Chrome Version
116.0.5841.0 Canary
Node Version
18.16.0
OS
Mac
Relevant log output
No response
FAQ
URL
https://jsbin.com/rosesuluyi/9/edit?html,js,console
What happened?
tldr; It seems the Main Thread Blocking Time and the Long Main Thread Tasks duration don't correctly add up for external scripts.
I've learned the following definitions of the terms:
A Long Tasks is a task that takes longer that 50ms to complete. The part of the task that is longer than 50ms is called the 'blocking time'. If this is happening on the Main Thread, this is called "Main Thread Blocking Time".
This is not to be confused with Total Blocking Time (which isn't total at all, but the sum between FCP and TTI).
e.g. a task takes 250ms to complete will be a Long Task, and has a blocking time of 200ms.
I am trying to use lighthouse to asses the performance of a third-party script on a page.
Lighthouse outputs information about the Main-Thread Blocking Time in the "Reduce the impact of third-party code" category, and information about the Long Tasks in the "Avoid long main-thread tasks" section.
Given the above formula, I would have expected the sum of Long Tasks for a specific script - 50 * (amount) would be equal to the reported Main Thread Blocking Time.
However I did notice that the numbers were not matching.
On our real testpages, which I cannot disclose, the difference is bigger than on the sample page above. Possible also related to a lot more code running on the pages from different sources. If truly required I can see about setting up such a page for public.
What did you expect?
I would have expected the numbers to add up.
So that I could take the Total long task duration and the number of long tasks and use it to calculate the Main Thread Blocking time.
What have you tried?
I understand at some points lists are truncated to 20 entries, and because of that, it might be possible that the total numbers don't add up. But in this case there are always less than 20 entries.
I was also thinking that maybe lighthouse would do different passes to calculate the different data, and the data not matching being caused by variance, but as far as I can see, lighthouse only performs one pass.
To setup this linked test I managed to reproduce the behavior in Chrome Devtools, but I originally found the issue in Lighthouse-ci / cli
How were you running Lighthouse?
CLI, Chrome DevTools
Lighthouse Version
10.1.0
Chrome Version
116.0.5841.0 Canary
Node Version
18.16.0
OS
Mac
Relevant log output
No response