'Google Lighthouse Performance Calculator Formula

I'm trying to mimic Lighthouse performance calculator but I don't know the formula for it. Say the weighted percentage from their website is:

FCP : 10%
SI : 10%
LCP : 25%
TTI : 10%
TBT : 30%
CLS : 15%

Given the weighted percentage above here's a sample value:

FCP : 1590 ms
SI : 4060 ms
LCP : 1590 ms
TTI : 9035 ms
TBT : 624 ms
CLS : 0.01

I compute it this way:

fcp_total = fcp_value * fcp_weighted_percentage;
si_total = si_value * si_weighted_percentage;
lcp_total = lcp_value * lcp_weighted_percentage;
tti_total = tti_value * tti_weighted_percentage;
tbt_total = tbt_value * tbt_weighted_percentage;
cls_total = cls_value * cls_weighted_percentage;

performance_score = fcp_total + si_total + lcp_total + tti_total + tbt_total + cls_total;

But I'm not getting the correct result like in this website. https://googlechrome.github.io/lighthouse/scorecalc/#FCP=1590&TTI=9035&SI=4060&TBT=624&LCP=1590&CLS=0.01&FMP=1590&device=desktop&version=9.4.0

Hope Someone can shed a light on this. Thank you.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source