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: warn when extensions affected perf #5666

Merged
merged 5 commits into from
Jul 18, 2018
Merged
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
14 changes: 13 additions & 1 deletion lighthouse-core/audits/bootup-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BootupTime extends Audit {
description: 'Consider reducing the time spent parsing, compiling, and executing JS. ' +
'You may find delivering smaller JS payloads helps with this. [Learn ' +
'more](https://developers.google.com/web/tools/lighthouse/audits/bootup).',
requiredArtifacts: ['traces'],
requiredArtifacts: ['traces', 'LighthouseRunWarnings'],
};
}

Expand Down Expand Up @@ -84,6 +84,7 @@ class BootupTime extends Audit {
* @return {Promise<LH.Audit.Product>}
*/
static async audit(artifacts, context) {
const runWarnings = artifacts.LighthouseRunWarnings;
const settings = context.settings || {};
const trace = artifacts.traces[BootupTime.DEFAULT_PASS];
const devtoolsLog = artifacts.devtoolsLogs[BootupTime.DEFAULT_PASS];
Expand All @@ -95,6 +96,7 @@ class BootupTime extends Audit {
const jsURLs = BootupTime.getJavaScriptURLs(networkRecords);
const executionTimings = BootupTime.getExecutionTimingsByURL(tasks, jsURLs);

let hadExcessiveChromeExtension = false;
let totalBootupTime = 0;
const results = Array.from(executionTimings)
.map(([url, timingByGroupId]) => {
Expand All @@ -113,6 +115,9 @@ class BootupTime extends Audit {
const scriptingTotal = timingByGroupId[taskGroups.scriptEvaluation.id] || 0;
const parseCompileTotal = timingByGroupId[taskGroups.scriptParseCompile.id] || 0;

hadExcessiveChromeExtension = hadExcessiveChromeExtension ||
(url.startsWith('chrome-extension:') && scriptingTotal > 100);

return {
url: url,
total: bootupTimeForURL,
Expand All @@ -124,6 +129,13 @@ class BootupTime extends Audit {
.filter(result => result.total >= context.options.thresholdInMs)
.sort((a, b) => b.total - a.total);


// TODO: consider moving this to core gathering so you don't need to run the audit for warning
if (hadExcessiveChromeExtension) {
runWarnings.push('Chrome extensions negatively affected this page\'s load performance. ' +
'Try auditing the page in incognito mode or from a clean Chrome profile.');
}

const summary = {wastedMs: totalBootupTime};

const headings = [
Expand Down