Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: add LCP phases to lantern test #15058

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions core/scripts/lantern/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ import {LH_ROOT} from '../../../root.js';
* @property {number} [timeToConsistentlyInteractive]
* @property {number} [speedIndex]
* @property {number} [largestContentfulPaint]
* @property {number} [timeToFirstByte]
* @property {number} [lcpLoadStart]
* @property {number} [lcpLoadEnd]
*/

/**
Expand All @@ -67,6 +70,9 @@ import {LH_ROOT} from '../../../root.js';
* @property {number} roughEstimateOfSI
* @property {number} roughEstimateOfTTI
* @property {number} roughEstimateOfLCP
* @property {number} roughEstimateOfTTFB
* @property {number} roughEstimateOfLCPLoadStart
* @property {number} roughEstimateOfLCPLoadEnd
*/

/** @type {Array<string>} */
Expand Down Expand Up @@ -196,6 +202,9 @@ export default {
roughEstimateOfSI: evaluate('speedIndex', 'roughEstimateOfSI'),
roughEstimateOfTTI: evaluate('timeToConsistentlyInteractive', 'roughEstimateOfTTI'),
roughEstimateOfLCP: evaluate('largestContentfulPaint', 'roughEstimateOfLCP'),
roughEstimateOfTTFB: evaluate('timeToFirstByte', 'roughEstimateOfTTFB'),
roughEstimateOfLCPLoadStart: evaluate('lcpLoadStart', 'roughEstimateOfLCPLoadStart'),
roughEstimateOfLCPLoadEnd: evaluate('lcpLoadEnd', 'roughEstimateOfLCPLoadEnd'),
};
},
};
8 changes: 6 additions & 2 deletions core/scripts/lantern/print-correlations.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function evaluateAndPrintAccuracy(metric, lanternMetric) {
const baselineOptions = {alwaysGray: !lanternMetric.includes('roughEstimate')};

const strings = [
lanternMetric.padEnd(25),
lanternMetric.padEnd(30),
`${toPercentString(actualAccuracy.p50)} ${toBaselineDiffString(
actualAccuracy.p50,
baselineAccuracy.p50,
Expand Down Expand Up @@ -216,7 +216,7 @@ function findAndPrintFixesRegressions() {

console.log(
chalk.bold(
'Metric'.padEnd(25),
'Metric'.padEnd(30),
'p50 (% Error)'.padEnd(20),
'p90 (% Error)'.padEnd(20),
'p95 (% Error)'.padEnd(20)
Expand All @@ -243,6 +243,10 @@ evaluateAndPrintAccuracy('largestContentfulPaint', 'optimisticLCP');
evaluateAndPrintAccuracy('largestContentfulPaint', 'pessimisticLCP');
evaluateAndPrintAccuracy('largestContentfulPaint', 'roughEstimateOfLCP');

evaluateAndPrintAccuracy('timeToFirstByte', 'roughEstimateOfTTFB');
evaluateAndPrintAccuracy('lcpLoadStart', 'roughEstimateOfLCPLoadStart');
evaluateAndPrintAccuracy('lcpLoadEnd', 'roughEstimateOfLCPLoadEnd');

const estimates = allEvaluations.filter(entry => entry.lanternMetric.includes('roughEstimate'));
const baselineEstimates = baselineEvaluations.filter(entry =>
entry.lanternMetric.includes('roughEstimate')
Expand Down
3 changes: 3 additions & 0 deletions core/scripts/lantern/run-on-all-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
* @property {number|undefined} timeToConsistentlyInteractive
* @property {number|undefined} speedIndex
* @property {number|undefined} largestContentfulPaint
* @property {number|undefined} timeToFirstByte
* @property {number|undefined} lcpLoadStart
* @property {number|undefined} lcpLoadEnd
*/
/** @typedef {{url:string, unthrottled: GoldenUnthrottled, wpt3g: Wpt3gUnthrottled}} GoldenSite */
/** @typedef {{sites: GoldenSite[]}} Golden */
Expand Down
5 changes: 4 additions & 1 deletion core/test/fixtures/lantern-baseline-accuracy.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
"p50": 0.20407433881343817,
"p90": 0.6299877796078848,
"p95": 0.8768898488120951
}
},
"roughEstimateOfTTFB": {},
"roughEstimateOfLCPLoadStart": {},
"roughEstimateOfLCPLoadEnd": {}
}