|
1 | 1 | # Compare HAR files |
2 | | -Make it easier to find regressions by comparing your [HAR](http://www.softwareishard.com/blog/har-12-spec/) files. Test it out https://compare.sitespeed.io or look at the video: https://youtu.be/dCThwpglIeE |
| 2 | +Make it easier to find regressions by comparing your [HAR](http://www.softwareishard.com/blog/har-12-spec/) files. Test it out https://compare.sitespeed.io. |
3 | 3 |
|
4 | 4 |  |
5 | 5 |
|
6 | 6 | ## First: Shout out! |
7 | | -We couldn't built compare without the support or inspiration from the following people: |
8 | | - * Thank you [Michael Mrowetz](https://twitter.com/MicMro) :bow: for creating [PerfCascade](https://github.com/micmro/PerfCascade) (the SVG HAR waterfall viewer). |
9 | | - * Thank you [Patrick Meenan](https://twitter.com/patmeenan) :bow:. Pat has built the HAR compare viewer in [WebPageTest](https://www.webpagetest.org/) that inspired us to the idea with the slider. |
| 7 | +We couldn't have built compare without the support or inspiration from the following people: |
| 8 | + * Thank you [Patrick Meenan](https://twitter.com/patmeenan) :bow:. The waterfall is rendered with Pat's [waterfall-tools](https://github.com/pmeenan/waterfall-tools), and the WebPageTest HAR compare viewer is what inspired the blend slider. |
| 9 | + * Thank you [Michael Mrowetz](https://twitter.com/MicMro) :bow:. Earlier versions of compare used Michael's [PerfCascade](https://github.com/micmro/PerfCascade) and it carried us for years. |
10 | 10 |
|
11 | 11 | If you like our project, please give them also some extra love :) |
12 | 12 |
|
13 | 13 | ## Comparing |
14 | 14 |  |
15 | 15 |
|
16 | 16 | ## How it works |
17 | | -As long as your HAR files follow the [HAR specification](http://www.softwareishard.com/blog/har-12-spec/) you can use them in Compare. Standard HARs will give you some basic functionality and HARs from WebPageTest and sitespeed.io will give you more. |
| 17 | +As long as your HAR files follow the [HAR specification](http://www.softwareishard.com/blog/har-12-spec/) you can use them in compare. Standard HARs give you the basics; HARs from WebPageTest and sitespeed.io/Browsertime unlock the extras. |
18 | 18 |
|
19 | | -### HARs from Firefox/Chrome/Safari (and other browsers). |
20 | | -For all HARs we will show the waterfall (using [PerfCascade](https://github.com/micmro/PerfCascade)) and statistics for the page (using [PageXray](https://github.com/sitespeedio/pagexray)). |
| 19 | +The result page is the same for every HAR — sections that don't apply silently stay hidden, so a plain Chrome HAR doesn't show a half-empty "filmstrip" or "CPU" block. |
21 | 20 |
|
22 | | -### WebPageTest |
23 | | -If you add a [WebPageTest](https://www.webpagetest.org) HAR we will show SpeedIndex and FirstVisualChange and if you used Chrome to collect CPU stats, we will show that too. You will get some extra sugar if your HAR is from WebPageTest! Do you have something else that we should add? Create an issue or send a PR! |
| 21 | +### What you get for every HAR |
| 22 | +* A **stacked waterfall** rendered by [waterfall-tools](https://github.com/pmeenan/waterfall-tools). Both HARs share the same time axis so widths are comparable at a glance. A **blend slider** fades HAR2 over HAR1, and a per-result toggle switches between **side-by-side** and **overlay**. Hovering a request highlights its peer in the other waterfall. |
| 23 | +* A **Page X-ray** table (powered by [PageXray](https://github.com/sitespeedio/pagexray)) grouped into sections — Content, Render blocking, Visual metrics, Core Web Vitals, CPU and First/Third party. A **Δ column** shows the HAR2−HAR1 delta with regressions in red and improvements in green. An **"Only differences"** toggle hides rows where the two HARs match. |
| 24 | +* A **request/response diff** when both HARs are for the same URL — added requests, removed requests, and (per-request) size, status and timing changes. Tick **"Strip version parameters"** on the start page (or set `"stripVersion": true` in your config) to ignore cache-busting query strings. |
| 25 | +* A **domains** breakdown. |
| 26 | +* Chrome HARs with priority hints also produce a **Render blocking** row (blocking / potentially blocking / in-body parser blocking). |
| 27 | +* `.har` and `.har.gz` are both accepted on drag/drop and via URL. |
24 | 28 |
|
25 | | -### sitespeed.io/Browsertime |
26 | | -If you want even more sugar, you should use HAR files from [sitespeed.io](https://github.com/sitespeedio/sitespeed.io) or [Browsertime](https://github.com/sitespeedio/browsertime): SpeedIndex, FirstVisualChange, LastVisualChange and a graph for VisualProgress. |
| 29 | +### Extras for WebPageTest HARs |
| 30 | +SpeedIndex, FirstVisualChange and, if the run was captured on Chrome with the CPU profile enabled, CPU timings. |
27 | 31 |
|
28 | | -If you deploy your result from your sitespeed.io run to a server and use **--resultBaseURL** when you run sitespeed.io, we will also pickup the screenshot, video and a link to the result page. |
| 32 | +### Extras for sitespeed.io / Browsertime HARs |
| 33 | +* **Visual progress chart** with a line per HAR and vertical timing markers (First Visual Change, FCP, LCP and Speed Index) so a regressed metric shows up as two side-by-side guide lines. |
| 34 | +* A **filmstrip** section sampled from the VisualProgress change points, with a lightbox for full-size frames, plus a small thumbnail strip under the visual-progress chart. |
| 35 | +* The full set of visual metrics (FirstVisualChange, LargestImage, Logo, Heading, Speed Index, LastVisualChange, Visual Readiness). |
| 36 | +* **Core Web Vitals**: First Contentful Paint, Largest Contentful Paint, Total Blocking Time, Cumulative Layout Shift. |
| 37 | +* CPU details when sitespeed.io ran Lighthouse: Long Tasks, Total Blocking Time, Max Potential FID. |
29 | 38 |
|
30 | | -If you also run with **--firstParty** (adding a regex that show which assets that are first/third parties) we will will show data grouped by party. |
| 39 | +If you deploy your sitespeed.io result with **--resultBaseURL**, compare will pick up the screenshot, video and a link to the result page. |
| 40 | + |
| 41 | +PageXray auto-detects first-party hosts from the page URL. If you want to override it (e.g. multi-domain sites), pass a regex via **--firstParty** when running sitespeed.io, or set `"firstParty"` in the config below; the result page then shows a first-vs-third party breakdown. |
31 | 42 |
|
32 | 43 |  |
33 | 44 |
|
@@ -67,6 +78,7 @@ But you can also add some extra sugar. All the extras are optional: |
67 | 78 | }, |
68 | 79 | "title": "The page title used in the title bar", |
69 | 80 | "firstParty" : " (.*wikipedia.*||.*wikimedia.*)", // RegEx that defines first party requests |
| 81 | + "stripVersion": true, // ignore query-string version params when diffing requests |
70 | 82 | "comments": { |
71 | 83 | "intro": "Extra information put at the top of the page", |
72 | 84 | "waterfall": "Text displayed at top of the waterfall", |
@@ -102,18 +114,22 @@ Add the parameters **?har1=FULL_URL1&har2=FULL_URL2&compare=1** and the two HAR |
102 | 114 |
|
103 | 115 | ## Developers |
104 | 116 |
|
105 | | -To run the project locally start a server with: |
| 117 | +The project is built with [Vite](https://vitejs.dev/). Compare uses a small Vite-bundled entry (`src/main.js`, which pulls in the CSS and the waterfall-tools wrapper) plus a set of classic-script modules in `public/js/compare/` that share globals on `window`. Vite serves `public/` verbatim in both dev and production, so editing a file under `public/js/compare/` is a hard reload away from running. |
| 118 | + |
| 119 | +Run the dev server: |
106 | 120 | ``` |
107 | 121 | npm run develop |
108 | 122 | ``` |
109 | 123 |
|
110 | | -Send us a PR/create an issue. If you have big change coming up, please discuss it with us in an issue first! |
| 124 | +Send us a PR / create an issue. If you have a big change coming up, please discuss it with us in an issue first. |
111 | 125 |
|
112 | 126 | ## Deploy your own version |
113 | 127 | Deploying your own version is easy: |
114 | 128 | 1. Clone the repo: `git clone git@github.com:sitespeedio/compare.git` |
115 | | -2. Build: `cd compare && npm run build` |
116 | | -3. Copy everything in *build/* to your server |
| 129 | +2. Build: `cd compare && npm install && npm run build` |
| 130 | +3. Copy everything in `dist/` to your server. |
| 131 | + |
| 132 | +The build version-stamps the classic compare scripts so a new deploy invalidates any stale copies cached by visitors. |
117 | 133 |
|
118 | 134 | ## Privacy |
119 | 135 | We take your privacy really serious: We do not use any tracking software at all (no Google Analytics or any other tracking software) in [compare.sitespeed.io](https://compare.sitespeed.io). The page do no call home. |
|
0 commit comments