GoogleChrome / lighthouse-ci

Automate running Lighthouse for every commit, viewing the changes, and preventing regressions
Apache License 2.0
6.44k stars 648 forks source link

Scores for dashboard and viewer are different. #848

Open kangyeop opened 1 year ago

kangyeop commented 1 year ago

As shown in the image below, the dashboard and viewer scores are different. Maybe this is the spec? If it's a bug, can I fix it myself and make a PR?

image image
gilhanan commented 9 months ago

that's because the perfomance graph value is calculated as the median value of the whole performance category runs:

category_performance_median: categoryScoreMedian('performance')

while the report is the most representitve run which is the medians of FCP and TTI:

function getMedianSortValue(lhr, medianFcp, medianInteractive) {
  const distanceFcp = medianFcp - getAuditValue(lhr, 'first-contentful-paint');
  const distanceInteractive = medianInteractive - getAuditValue(lhr, 'interactive');

  return distanceFcp * distanceFcp + distanceInteractive * distanceInteractive;
}