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

core: use the same scoring curve for desktop in all channels #9911

Merged
merged 16 commits into from
Nov 10, 2019
26 changes: 17 additions & 9 deletions lighthouse-core/audits/metrics/first-contentful-paint.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FirstContentfulPaint extends Audit {
title: str_(i18n.UIStrings.firstContentfulPaintMetric),
description: str_(UIStrings.description),
scoreDisplayMode: Audit.SCORING_MODES.NUMERIC,
requiredArtifacts: ['traces', 'devtoolsLogs'],
requiredArtifacts: ['traces', 'devtoolsLogs', 'HostDevice'],
};
}

Expand All @@ -36,12 +36,19 @@ class FirstContentfulPaint extends Audit {
*/
static get defaultOptions() {
return {
// 75th and 95th percentiles HTTPArchive -> median and PODR
// https://bigquery.cloud.google.com/table/httparchive:lighthouse.2018_04_01_mobile?pli=1
// see https://www.desmos.com/calculator/2t1ugwykrl
scorePODR: 2000,
scoreMedian: 4000,
};
mobile: {
// 75th and 95th percentiles HTTPArchive -> median and PODR
// https://bigquery.cloud.google.com/table/httparchive:lighthouse.2018_04_01_mobile?pli=1
// see https://www.desmos.com/calculator/2t1ugwykrl
scorePODR: 2000,
scoreMedian: 4000,
},
desktop: {
// SELECT QUANTILES(renderStart, 21) FROM [httparchive:summary_pages.2018_12_15_desktop] LIMIT 1000
scorePODR: 800,
scoreMedian: 1600,
},
}
}

/**
Expand All @@ -54,12 +61,13 @@ class FirstContentfulPaint extends Audit {
const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS];
const metricComputationData = {trace, devtoolsLog, settings: context.settings};
const metricResult = await ComputedFcp.request(metricComputationData, context);
const scoreOptions = context.options[artifacts.TestedAsMobileDevice ? 'mobile' : 'desktop'];

return {
score: Audit.computeLogNormalScore(
metricResult.timing,
context.options.scorePODR,
context.options.scoreMedian
scoreOptions.scorePODR,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should still note this as a breaking change in release notes, but this WFM 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed. we should adopt a way to signify breaking changes for release-notes-writing time.

scoreOptions.scoreMedian
),
numericValue: metricResult.timing,
displayValue: str_(i18n.UIStrings.seconds, {timeInMs: metricResult.timing}),
Expand Down
1 change: 1 addition & 0 deletions lighthouse-core/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const BASE_ARTIFACT_BLANKS = {
fetchTime: '',
LighthouseRunWarnings: '',
TestedAsMobileDevice: '',
HostDevice: '',
HostUserAgent: '',
NetworkUserAgent: '',
BenchmarkIndex: '',
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/config/lr-desktop-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const config = {
audits: [
// 75th and 95th percentiles -> median and PODR
// SELECT QUANTILES(renderStart, 21) FROM [httparchive:summary_pages.2018_12_15_desktop] LIMIT 1000
{path: 'metrics/first-contentful-paint', options: {scorePODR: 800, scoreMedian: 1600}},
// {path: 'metrics/first-contentful-paint', options: {scorePODR: 800, scoreMedian: 1600}},
{path: 'metrics/first-meaningful-paint', options: {scorePODR: 800, scoreMedian: 1600}},
// 75th and 95th percentiles -> median and PODR
// SELECT QUANTILES(SpeedIndex, 21) FROM [httparchive:summary_pages.2018_12_15_desktop] LIMIT 1000
Expand Down