88const Audit = require ( './audit' ) ;
99const Util = require ( '../report/v2/renderer/util.js' ) ;
1010const TracingProcessor = require ( '../lib/traces/tracing-processor' ) ;
11- const statistics = require ( '../lib/statistics' ) ;
1211
1312// Parameters (in ms) for log-normal CDF scoring. To see the curve:
1413// https://www.desmos.com/calculator/uti67afozh
@@ -19,11 +18,6 @@ const REQUIRED_QUIET_WINDOW = 5000;
1918const ALLOWED_CONCURRENT_REQUESTS = 2 ;
2019const IGNORED_NETWORK_SCHEMES = [ 'data' , 'ws' ] ;
2120
22- const distribution = statistics . getLogNormalDistribution (
23- SCORING_MEDIAN ,
24- SCORING_POINT_OF_DIMINISHING_RETURNS
25- ) ;
26-
2721/**
2822 * @fileoverview This audit identifies the time the page is "consistently interactive".
2923 * Looks for the first period of at least 5 seconds after FMP where both CPU and network were quiet,
@@ -234,14 +228,12 @@ class ConsistentlyInteractiveMetric extends Audit {
234228 const timeInMs = ( timestamp - traceOfTab . timestamps . navigationStart ) / 1000 ;
235229 const extendedInfo = Object . assign ( quietPeriodInfo , { timestamp, timeInMs} ) ;
236230
237- let score = 100 * distribution . computeComplementaryPercentile ( timeInMs ) ;
238- // Clamp the score to 0 <= x <= 100.
239- score = Math . min ( 100 , score ) ;
240- score = Math . max ( 0 , score ) ;
241- score = Math . round ( score ) ;
242-
243231 return {
244- score,
232+ score : Audit . computeLogNormalScore (
233+ timeInMs ,
234+ SCORING_POINT_OF_DIMINISHING_RETURNS ,
235+ SCORING_MEDIAN
236+ ) ,
245237 rawValue : timeInMs ,
246238 displayValue : Util . formatMilliseconds ( timeInMs ) ,
247239 optimalValue : this . meta . optimalValue ,
0 commit comments