Skip to content

Commit a376f49

Browse files
committed
cleanup and add new lighthouse metrics
1 parent 7bcdc97 commit a376f49

File tree

7 files changed

+60
-281
lines changed

7 files changed

+60
-281
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"rebuild-all": "node rebuild-all.js --ci",
99
"build": "echo \"Please use 'npm run rebuild-all' instead\" && exit 1",
1010
"build-prod": "echo \"Please use 'npm run rebuild-all' instead\" && exit 1",
11-
"compile": "node rebuild-all.js --ci",
11+
"compile": "echo \"Please use 'npm run rebuild-all' instead\" && exit 1",
1212
"start": "cd server && node index.js",
1313
"bench": "cd webdriver-ts && cross-env LANG=\"en_US.UTF-8\" node dist/benchmarkRunner.js",
1414
"checkCSP": "cd webdriver-ts && cross-env LANG=\"en_US.UTF-8\" node dist/isCSPCompliant.js",

webdriver-ts-results/src/reducer.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ import {
2020
knownIssues,
2121
} from "./Common";
2222

23-
const benchmarks = rawBenchmarks.filter(
24-
(benchmark) =>
25-
benchmark.id !== "32_startup-bt" &&
26-
benchmark.id !== "33_startup-mainthreadcost",
27-
);
23+
const benchmarks = rawBenchmarks;
2824

2925
const results: Result[] = rawResults.map((result) => {
3026
const values: { [k: string]: ResultValues } = {};

webdriver-ts-results/src/results.ts

Lines changed: 41 additions & 260 deletions
Large diffs are not rendered by default.

webdriver-ts/results.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

webdriver-ts/src/benchmarksLighthouse.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,21 @@ export const benchStartupMainThreadWorkCost: StartupBenchmarkInfo = {
3737
type: BenchmarkType.STARTUP,
3838
};
3939

40-
export const benchStartupTotalBytes: StartupBenchmarkInfo = {
41-
id: "34_startup-totalbytes",
42-
label: "total kilobyte weight",
43-
description: () => "network transfer cost (post-compression) of all the resources loaded into the page.",
44-
property: "total-byte-weight",
45-
fn: toKb,
40+
export const benchStartupMainInteractive: StartupBenchmarkInfo = {
41+
id: "34_startup-interactive",
42+
label: "interactive",
43+
description: () => "Time to Interactive is the amount of time it takes for the page to become fully interactive.",
44+
property: "interactive",
45+
fn: id,
4646
type: BenchmarkType.STARTUP,
4747
};
4848

49+
4950
export const subbenchmarks = [
5051
benchStartupConsistentlyInteractive,
5152
benchStartupBootup,
5253
benchStartupMainThreadWorkCost,
53-
benchStartupTotalBytes,
54+
benchStartupMainInteractive,
5455
];
5556

5657
export class BenchmarkLighthouse implements BenchmarkImpl {

webdriver-ts/src/forkedBenchmarkRunnerLighthouse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async function runLighthouse(
5959
await chrome.kill();
6060
throw error;
6161
}
62-
if (config.LOG_DEBUG) console.log("lighthouse result", results);
62+
if (config.LOG_DEBUG) console.log("lighthouse result", JSON.stringify(results));
6363

6464
return startupBenchmarks.map((bench) => ({
6565
benchmark: bench,

webdriver-ts/src/timeline.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const tracePaintEventNames = [
9494
"Paint",
9595
"Layerize",
9696
"PrePaint"
97-
// including "PrePaint" causes longer duraations as reported by chrome
97+
// including "PrePaint" causes longer durations as reported by chrome
9898
];
9999

100100
export function extractRelevantTraceEvents(config: Config, relevantEventNames: string[], entries: any[], includeClick: boolean) {
@@ -430,12 +430,13 @@ export async function computeResultsFromTrace(
430430
for (let ev of eventsWithin) {
431431
intervals = newContainedInterval(ev, intervals);
432432
}
433-
if (intervals.length > 1) {
434-
console.log(`*** More than 1 interval ${intervals.length} for ${fileName}`, intervals);
435-
} else {
436-
console.log(`1 interval for ${fileName}`, intervals);
433+
if (config.LOG_DETAILS) {
434+
if (intervals.length > 1) {
435+
console.log(`*** More than 1 interval ${intervals.length} for ${fileName}`, intervals);
436+
} else {
437+
console.log(`1 interval for ${fileName}`, intervals);
438+
}
437439
}
438-
439440
let res = intervals.reduce((p, c) => p + (c.end - c.start), 0) / 1000.0;
440441
return res;
441442
}

0 commit comments

Comments
 (0)