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

report: sort performance audits based on impact #15445

Merged
merged 39 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
129319d
get overall impact for all audits
adrianaixba Aug 11, 2023
b6abb30
Merge branch 'main' into metric-savings-score
adrianaixba Aug 11, 2023
7881ecd
calculate overall impact
adrianaixba Aug 11, 2023
317f85c
Merge branch 'main' into metric-savings-score
adamraine Aug 16, 2023
2a7ef45
linear impact + old scoring fallback
adamraine Aug 16, 2023
4f7b7f4
rm color indicators
adrianaixba Aug 16, 2023
3adb1e1
Merge branch 'main' into metric-savings-score
adrianaixba Aug 31, 2023
e1ebbb8
add simple guidance level sort
adrianaixba Aug 31, 2023
6a642ad
add gl to impact, rm dependency on score
adrianaixba Aug 31, 2023
9838c9c
fall back to old sort
adamraine Sep 1, 2023
be2455b
remove guidance level from main sort
adrianaixba Sep 6, 2023
212be08
add metrics filter back
adrianaixba Sep 8, 2023
5f0f5f7
sample json
adrianaixba Sep 8, 2023
629f841
Merge branch 'main' into metric-savings-score
adrianaixba Sep 20, 2023
74d1cb9
fix
adrianaixba Sep 20, 2023
be716af
update proto
adrianaixba Sep 21, 2023
c2521ad
add tests
adrianaixba Sep 21, 2023
8b1fd65
nit
adrianaixba Sep 22, 2023
9ed4c98
Merge branch 'main' into metric-savings-score
adrianaixba Sep 22, 2023
c1d75f8
nit
adrianaixba Sep 22, 2023
b658d37
nit
adrianaixba Sep 22, 2023
6a56412
fix perf render tests
adrianaixba Sep 26, 2023
3e2af6c
move statistics
adrianaixba Sep 26, 2023
1b06077
Merge branch 'main' into metric-savings-score
adrianaixba Sep 26, 2023
d49ee44
test fixie
adrianaixba Sep 26, 2023
ae40a9b
fixes
adrianaixba Sep 26, 2023
3266cf3
nit fixie
adrianaixba Sep 26, 2023
ce877bd
cleanups
adrianaixba Sep 26, 2023
b2b98e2
nit
adrianaixba Sep 26, 2023
c2600ef
nit
adrianaixba Sep 26, 2023
2352042
nit
adrianaixba Sep 26, 2023
4d2e45b
nitsss
adrianaixba Sep 26, 2023
17f4fef
add comments
adrianaixba Sep 27, 2023
68f0793
avoid recalculating impact details
adrianaixba Oct 2, 2023
b7e3930
Merge branch 'main' into metric-savings-score
adrianaixba Oct 2, 2023
91892d7
nits
adrianaixba Oct 2, 2023
02ebf4b
nit
adrianaixba Oct 2, 2023
7d44fff
Merge branch 'main' into metric-savings-score
adamraine Oct 2, 2023
235f258
nit
adamraine Oct 2, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ exports[`getAssertionReport works (multiple failing) 1`] = `
\\"numericValue\\": 0.13570762803819444,
\\"numericUnit\\": \\"unitless\\",
\\"displayValue\\": \\"0.136\\",
\\"scoringOptions\\": {
\\"p10\\": 0.1,
\\"median\\": 0.25
},
\\"details\\": {
\\"type\\": \\"debugdata\\",
\\"items\\": [
Expand All @@ -46,6 +50,10 @@ exports[`getAssertionReport works (trivial failing) 1`] = `
\\"numericValue\\": 0.13570762803819444,
\\"numericUnit\\": \\"unitless\\",
\\"displayValue\\": \\"0.136\\",
\\"scoringOptions\\": {
\\"p10\\": 0.1,
\\"median\\": 0.25
},
\\"details\\": {
\\"type\\": \\"debugdata\\",
\\"items\\": [
Expand Down
13 changes: 4 additions & 9 deletions core/audits/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import * as LH from '../../types/lh.js';
import {isUnderTest} from '../lib/lh-env.js';
import * as statistics from '../lib/statistics.js';
import {Util} from '../../shared/util.js';

const DEFAULT_PASS = 'defaultPass';
Expand Down Expand Up @@ -105,14 +104,7 @@ class Audit {
* @return {number}
*/
static computeLogNormalScore(controlPoints, value) {
let percentile = statistics.getLogNormalScore(controlPoints, value);
// Add a boost to scores of 90+, linearly ramping from 0 at 0.9 to half a
// point (0.005) at 1. Expands scores in (0.9, 1] to (0.9, 1.005], so more top
// scores will be a perfect 1 after the two-digit `Math.floor()` rounding below.
if (percentile > 0.9) { // getLogNormalScore ensures `percentile` can't exceed 1.
percentile += 0.05 * (percentile - 0.9);
}
return Math.floor(percentile * 100) / 100;
return Util.computeLogNormalScore(controlPoints, value);
}

/**
Expand Down Expand Up @@ -411,8 +403,11 @@ class Audit {
errorMessage: product.errorMessage,
errorStack: product.errorStack,
warnings: product.warnings,
scoringOptions: product.scoringOptions,
metricSavings: product.metricSavings,

details: product.details,
guidanceLevel: audit.meta.guidanceLevel,
};
}

Expand Down
2 changes: 1 addition & 1 deletion core/audits/byte-efficiency/uses-long-cache-ttl.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import parseCacheControl from 'parse-cache-control';
import {Audit} from '../audit.js';
import {NetworkRequest} from '../../lib/network-request.js';
import UrlUtils from '../../lib/url-utils.js';
import {linearInterpolation} from '../../lib/statistics.js';
import {linearInterpolation} from '../../../shared/statistics.js';
import * as i18n from '../../lib/i18n/i18n.js';
import {NetworkRecords} from '../../computed/network-records.js';

Expand Down
5 changes: 4 additions & 1 deletion core/audits/metrics/cumulative-layout-shift.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ class CumulativeLayoutShift extends Audit {
items: [rest],
};

const scoringOptions = {p10: context.options.p10, median: context.options.median};

return {
score: Audit.computeLogNormalScore(
{p10: context.options.p10, median: context.options.median},
scoringOptions,
cumulativeLayoutShift
),
scoringOptions,
numericValue: cumulativeLayoutShift,
numericUnit: 'unitless',
displayValue: cumulativeLayoutShift.toLocaleString(context.settings.locale),
Expand Down
1 change: 1 addition & 0 deletions core/audits/metrics/first-contentful-paint.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class FirstContentfulPaint extends Audit {
options.scoring,
metricResult.timing
),
scoringOptions: options.scoring,
numericValue: metricResult.timing,
numericUnit: 'millisecond',
displayValue: str_(i18n.UIStrings.seconds, {timeInMs: metricResult.timing}),
Expand Down
1 change: 1 addition & 0 deletions core/audits/metrics/largest-contentful-paint.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class LargestContentfulPaint extends Audit {
options.scoring,
metricResult.timing
),
scoringOptions: options.scoring,
numericValue: metricResult.timing,
numericUnit: 'millisecond',
displayValue: str_(i18n.UIStrings.seconds, {timeInMs: metricResult.timing}),
Expand Down
1 change: 1 addition & 0 deletions core/audits/metrics/speed-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class SpeedIndex extends Audit {
options.scoring,
metricResult.timing
),
scoringOptions: options.scoring,
numericValue: metricResult.timing,
numericUnit: 'millisecond',
displayValue: str_(i18n.UIStrings.seconds, {timeInMs: metricResult.timing}),
Expand Down
1 change: 1 addition & 0 deletions core/audits/metrics/total-blocking-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class TotalBlockingTime extends Audit {
options.scoring,
metricResult.timing
),
scoringOptions: options.scoring,
numericValue: metricResult.timing,
numericUnit: 'millisecond',
displayValue: str_(i18n.UIStrings.ms, {timeInMs: metricResult.timing}),
Expand Down
Loading
Loading