Skip to content

Commit

Permalink
Upgrade lighthouse and add screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
saulshanabrook committed Jul 11, 2019
1 parent d04d907 commit bcc93c0
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 101 deletions.
84 changes: 48 additions & 36 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ Now run Lighthouse against this local server and show the results:
jlpm run lighthouse --view
```

![](./docs/source/images/lighthouse-screenshot.png)
![](./docs/source/images/lighthouse.png)

### Using throttling

Expand Down Expand Up @@ -312,87 +312,99 @@ This gives us a report of the relative differences between the audits in the two
>
> **First Contentful Paint**
>
> - -13% Δ
> - 1.1 s -> 1.0 s
> - -62% Δ
> - 1.9 s -> 0.7 s
> - First Contentful Paint marks the time at which the first text or image is painted. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/first-contentful-paint).
>
> **First Meaningful Paint**
>
> - -13% Δ
> - 1.1 s -> 1.0 s
> - -50% Δ
> - 2.5 s -> 1.3 s
> - First Meaningful Paint measures when the primary content of a page is visible. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/first-meaningful-paint).
>
> **Speed Index**
>
> - -12% Δ
> - 1.2 s -> 1.1 s
> - -48% Δ
> - 2.6 s -> 1.3 s
> - Speed Index shows how quickly the contents of a page are visibly populated. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/speed-index).
>
> **Estimated Input Latency**
>
> - 0% Δ
> - 20 ms -> 20 ms
> - The score above is an estimate of how long your app takes to respond to user input, in milliseconds, during the busiest 5s window of page load. If your latency is higher than 50 ms, users may perceive your app as laggy. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/estimated-input-latency).
> - Estimated Input Latency is an estimate of how long your app takes to respond to user input, in milliseconds, during the busiest 5s window of page load. If your latency is higher than 50 ms, users may perceive your app as laggy. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/estimated-input-latency).
>
> **Max Potential First Input Delay**
>
> - 9% Δ
> - 200 ms -> 210 ms
> - The maximum potential First Input Delay that your users could experience is the duration, in milliseconds, of the longest task. [Learn more](https://developers.google.com/web/updates/2018/05/first-input-delay).
>
> **First CPU Idle**
>
> - -13% Δ
> - 1.1 s -> 1.0 s
> - -50% Δ
> - 2.5 s -> 1.3 s
> - First CPU Idle marks the first time at which the page's main thread is quiet enough to handle input. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/first-interactive).
>
> **Time to Interactive**
>
> - -13% Δ
> - 1.1 s -> 1.0 s
> - Interactive marks the time at which the page is fully interactive. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/consistently-interactive).
> - -52% Δ
> - 2.5 s -> 1.2 s
> - Time to interactive is the amount of time it takes for the page to become fully interactive. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/consistently-interactive).
>
> **Avoid multiple page redirects**
>
> - 0% Δ
> - Potential savings of 450 ms -> Potential savings of 450 ms
> - -2% Δ
> - Potential savings of 10 ms -> Potential savings of 10 ms
> - Redirects introduce additional delays before the page can be loaded. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/redirects).
>
> **Minimizes main-thread work**
> **Minimize main-thread work**
>
> - -40% Δ
> - 0.4 s -> 0.2 s
> - -54% Δ
> - 2.1 s -> 1.0 s
> - Consider reducing the time spent parsing, compiling and executing JS. You may find delivering smaller JS payloads helps with this.
>
> **JavaScript execution time**
>
> - -100% Δ
> - 0.1 s ->
> - -49% Δ
> - 1.1 s -> 0.6 s
> - 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).
>
> **Avoids enormous network payloads**
> **Preload key requests**
>
> - -100% Δ
> - Potential savings of 240 ms ->
> - Consider using <link rel=preload> to prioritize fetching resources that are currently requested later in page load. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/preload).
>
> **Uses efficient cache policy on static assets**
>
> - 0% Δ
> - Total size was 531 KB -> Total size was 531 KB
> - Large network payloads cost users real money and are highly correlated with long load times. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/network-payloads).
> - 1 resource found -> 1 resource found
> - A long cache lifetime can speed up repeat visits to your page. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/cache-policy).
>
> **Eliminate render-blocking resources**
> **Avoid enormous network payloads**
>
> - 1% Δ
> - Potential savings of 1,340 ms -> Potential savings of 1,340 ms
> - Resources are blocking the first paint of your page. Consider delivering critical JS/CSS inline and deferring all non-critical JS/styles. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/blocking-resources).
> - -86% Δ
> - Total size was 30,131 KB -> Total size was 4,294 KB
> - Large network payloads cost users real money and are highly correlated with long load times. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/network-payloads).
>
> **Defer unused CSS**
> **Minify JavaScript**
>
> - 0% Δ
> - Potential savings of 288 KB -> Potential savings of 288 KB
> - Remove unused rules from stylesheets to reduce unnecessary bytes consumed by network activity. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/unused-css).
> - -100% Δ
> - Potential savings of 23,041 KB ->
> - Minifying JavaScript files can reduce payload sizes and script parse time. [Learn more](https://developers.google.com/speed/docs/insights/MinifyResources).
>
> **Enable text compression**
>
> - 0% Δ
> - Potential savings of 399 KB -> Potential savings of 399 KB
> - -86% Δ
> - Potential savings of 23,088 KB -> Potential savings of 3,112 KB
> - Text-based resources should be served with compression (gzip, deflate or brotli) to minimize total network bytes. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/text-compression).
>
> **Avoids an excessive DOM size**
> **Avoid an excessive DOM size**
>
> - 0% Δ
> - 73 nodes -> 73 nodes
> - Browser engineers recommend pages contain fewer than ~1,500 DOM nodes. The sweet spot is a tree depth < 32 elements and fewer than 60 children/parent element. A large DOM can increase memory usage, cause longer [style calculations](https://developers.google.com/web/fundamentals/performance/rendering/reduce-the-scope-and-complexity-of-style-calculations), and produce costly [layout reflows](https://developers.google.com/speed/articles/reflow). [Learn more](https://developers.google.com/web/tools/lighthouse/audits/dom-size).
> - 1,268 elements -> 1,268 elements
> - Browser engineers recommend pages contain fewer than ~1,500 DOM elements. The sweet spot is a tree depth < 32 elements and fewer than 60 children/parent element. A large DOM can increase memory usage, cause longer [style calculations](https://developers.google.com/web/fundamentals/performance/rendering/reduce-the-scope-and-complexity-of-style-calculations), and produce costly [layout reflows](https://developers.google.com/speed/articles/reflow). [Learn more](https://developers.google.com/web/tools/lighthouse/audits/dom-size).
### Build and run the stand-alone examples

Expand Down
Binary file added docs/source/images/lighthouse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"get:dependency": "node buildutils/lib/get-dependency.js",
"postinstall": "node scripts/ensure-buildutils.js",
"integrity": "node buildutils/lib/ensure-repo.js",
"lighthouse": "lighthouse http://localhost:8888/ --chrome-flags='--headless' --disable-device-emulation --throttling-method=provided --only-categories performance",
"lighthouse": "lighthouse http://localhost:8888/ --chrome-flags='--headless' --emulated-form-factor=none --throttling-method=provided --only-categories performance",
"lighthouse:compare": "node testutils/lib/compare-lighthouse.js",
"lighthouse:throttling:start": "comcast --latency=40 --target-bw=30000 --packet-loss=0.2%",
"lighthouse:throttling:stop": "comcast --stop",
Expand Down
2 changes: 1 addition & 1 deletion testutils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"devDependencies": {
"@types/node-fetch": "^2.3.4",
"lighthouse": "4.0.0-alpha.2-3.2.1",
"lighthouse": "5.1.0",
"typescript": "~3.5.1"
}
}
6 changes: 4 additions & 2 deletions testutils/src/compare-lighthouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface IOutput {
description: string;
scoreDisplayMode: string;
displayValue: string;
rawValue: number;
numericValue: number;
};
};
}
Expand All @@ -34,7 +34,9 @@ for (const auditName in first.audits) {
}
const secondAudit = second.audits[auditName];
const percentChange =
((secondAudit.rawValue - firstAudit.rawValue) / firstAudit.rawValue) * 100;
((secondAudit.numericValue - firstAudit.numericValue) /
firstAudit.numericValue) *
100;

if (isNaN(percentChange)) {
continue;
Expand Down
Loading

0 comments on commit bcc93c0

Please sign in to comment.