-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Early Preview of LightWallet (Performance Budgets in Lighthouse) #7176
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
Conversation
brendankenny
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exciting!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️
Note for reviewers: for now let's concentrate on feedback on user experience, display in the report, and actionability before digging into the current implementation/lighthouse-dev experience.
Things may move around or change quite a bit before we figure out exactly how we want to integrate everything into the report, and focusing on i18n descriptions or ideal details renderer placement will just be a distraction :)
|
Here are two HTML reports using this branch.. roughly the same as the screenshots: |
|
Awesome very exciting!! Displaying multiple different connection types in one report is really interesting! We had old ideas to try and do this in the performance section once upon a time but tabled it due to the extra complexity. This might be a good time to revisit that too! :D I'm curious if we expect budgets on # of requests and byte weight to vary based on differences in connection quality or throttling. I'd probably expect these to vary more with form factor or the |
|
There are a few considerations to discuss that I'd like feedback on.
|
+1
+1
I believe there was originally a plan to have us read
This is a really interesting point to resurface. I would personally love to see something like this applied across perf scoring in general :) I really dig the idea of a new resource types subsection of performance where we report stats by default and apply budgets directly ontop of if budgets are active. 👍 |
|
Re: @kusler #1. 1. Resource vs transfer size (JS)? Re: #2 Default budget & platform packs, etc.? Re: #3 |
|
+1 to everything mentioned above except the report UI. I’m not particularly attached to the current tables/graphs, but I still think I prefer them over the the bullet graph styles. These are probably the two biggest reasons for my opinions on the table/charts:
Re: @kusler mock
Re: @paulirish Mock
Re: combining pageWeight & requests into one table
|
I'm supportive of this direction. "How did you arrive on those defaults?" is likely to come up when default budgets are UX everyone experiences. Time to finesse sg. There are many potential sources for what these should be:
+1. Circling back to evaluating this further down the line or in a limited (just one) form works.
I agree with Katie this could use some further discussion. It's pretty straight-forward for CLI. Outside of that a few options:
I'll defer to @khempenius on the Report UX. I'm inclined say pass/fail is more consistent with the type of story one would tell for budgets in other places (e.g CI) but I otherwise don't have super strong opinions on the bullet graph approach. |
Lighthouse itself also has a notion of budgets for most of these metrics. You just need to pick an acceptable score threshold (e.g. always get a 90) and the raw numbers are an easy lookup :) |
If we go this route, we should also support applying different budgets for different pages on a site (as in, not force the entire site to use the same budget). Something like Just supplying a single budget |
it would be great to use a most tools use this convention, like github, travis ci to name a few well known ones. |
|
Hi team, After meeting with @khempenius , @kusler , @paulirish, I took a stab at some potential approaches. 1. Let's add "Resource file sizes and requests" line item in Diagnostics section, always (no budget set up needed Looks like there's a consensus on this, yay. 2. When budgets are set, add a special section 'Budgets' at the top Looks like there's a consensus on this as well, yay yay. 3. Explorations on ways to show problematics deltas (feel free to skip to 4. Recommendation) Started with essential data points: What/how much exceeded(<-- more important), and What/how much saved (<-- less important than 'exceeded', but, still need to know what's remained). 4. Recommendation Narrowing down, picked options that have better clarity on what needs the user attention first. 24 seems to carry essential info with minimum elements. 28 adds more elements, but, also gets more visual emphasis on what failed. My recommendation is 24, simpler visuals. Please share your views. Thanks team! |
|
FYI - Sketch file |
|
Feedback for next iteration:
|
Proposal: Support page-specific performance budgets in LightWalletMany people have commented elsewhere that they would like to be able to define page-specific performance budgets rather than being forced to use a single performance budget across their entire app. This could work like this: Specifying a URLThe url property will be mandatory for the Note: Technically a URL can be a regex too - it just only matches one string. Thus, there is no need to determine whether a user supplied a regex or a url - they are the same thing in the end and are evaluated using the same logic. Regexes can be written in JSON like this: "ab+c" (equivalent to /ab+c/) Regexes have native JavaScript support, so implementing this would not require adding dependencies. Alternatives Considered:
Interactions between budgetsAll matching Alternatives Considered:
|
regexes can be a denial of service issue. We'll need to do some sanitizing anyway if we're downloading these files, but one possible alternative would be the robots.txt format. It's widely known and is still used after such a long time, so in theory it has some merit despite its limitations :) |
|
🤦♀️Duh. I forgot about this executing on our servers for PSI, which adds security concerns. I like the idea of using the robots.txt format. {
"budgets": [
{
"path": "/",
"pageWeight": [ ... ],
"timings": [ ... ]
},
{
"path": "/blog*",
"pageWeight": [ ... ],
"timings": [ ... ]
}
]
}Paths Regular Expressions
I'd add the additional requirement that only one wildcard per URL will be allowed. This seems to match robots.txt convention (although I haven't been able to find a mention of this in the spec either way) and would simplify the logic required to implement this. Further sanitization measures
|
|
A revision to emphasize deltas & place totals closer. I like this direction. WDY-all-T? From last feedback (2019/03/12)
|
|
Hi, Really excited about this! I have some feedback/ideas based on developing a similar custom audit a while back: Third Party
Document
Just realized that most of my feedback is about implementation and not just UX... |
|
Hey folks. I believe we’re blocked on UI and the local story for budgets.json (after talking to @khempenius and @brendankenny) so wanted to see if we could pave a way forward here Local supportSolving support for LightWallet for the CLI use-case is the P0 because it unlocks use for folks that want to use this in CI (or in their local dev workflow). We’ve seen some early partners use this PR in this way (already, funnily enough). Decisions to make:
Mid-term (post I/O?), I’d love to figure out how we can add UI support for selecting a local budgets.json file (via LH/DevTools). Given that we haven’t looped the DevTools team into this work yet, I’m unsure just how feasible that will be. We can look at this problem later on if we think it’ll require a lot of work. I don’t yet know if that would leverage DevTools Workspaces or if Lighthouse itself could let you select a file from the Audits panel. A non-CLI flow will unblock this feature to the masses. Report redesignBrendan shared that there’s a few changes to the report in the works: a UI redesign Hwi/Yuin are focused on, reporting diffing, LightWallet, and a few other bits that are resulting in some cyclical decisions we’re needing to make :) It’d be great if the redesign factored in budgeting. Is that currently the plan? We probably need a product decision here. If we want to ship LightWallet in the next month (...would love to do this for the MVP), I’m happy for us to commit to quickly rewriting how our implementation looks in the report if there are redesigns planned. We could probably tackle this as soon as needed after the work initially lands. I understand there are many parallel workstreams happening at the moment and wanted to acknowledge we need to make some decisions here.. :) From Brendan’s description, it seems like the redesign can be done iteratively which will assist with changing reports out from under folks. As I don’t...think? the redesign of the report has strict timelines around it, we may be able to take our time on those changes rolling out? Given budgets are optional (at first) perhaps this makes them easier to ship even if we think the UI will need some decent iteration over time. If there are rewrite changes that end up breaking LightWallet, we’re (Katie) okay with trying to keep up with this churn. Does this sound reasonable? Are there aspects of moving forward that I’m not factoring in? |
|
Thanks Addy for outlining the suggestions. A few UX notes: re: order between LW design and the new design re: budget file upload UI |
|
Thank you, Hwi. I'll await a call on next steps design wise from Paul, Elizabeth and team. Let's see what they think. UI for Budget config selection: That's a perfect visualization of what I had in mind! :) |
|
Closing in favor of individual PRs :) |
|
Is lightwallet released today? |










TLDR;
LightWallet adds performance budget tooling to Lighthouse. It supports page weight, request, and timing-based performance budgets. See #6053.
How to Use
Install this demo
$ git clone -b lightwallet [email protected]:GoogleChrome/lighthouse.git
$ cd lighthouse
$ npm install
Run Lighthouse
$ node lighthouse-cli https://www.example.com
LightWallet is run as a part of Lighthouse and requires no configuration. Out of the box LightWallet will use a default performance budget (which is based on page weight) to audit a page.
Result
Add a
budgets.jsonfile (optional)Adding a
budgets.jsonfile overrides LightWallet's default budget with a custom performance budget.The
budgets.jsonfile should be placed in thelighthouse/directory.Example budgets.json:
The below example uses all three of the metric types that LightWallet supports (page weight, request quantity, and timing). In addition, it uses two different network/CPU configurations when auditing the page.
{ "budgets": [ { "cpuThrottling": 4, "connectionType": "slow3G", "pageWeight": [ { "resourceType": "script", "budget": 100 }, { "resourceType": "image", "budget": 50 }, { "resourceType": "stylesheet", "budget": 10 }, { "resourceType": "document", "budget": 20 }, { "resourceType": "font", "budget": 0 }, { "resourceType": "thirdParty", "budget": 20 } ], "timings": [ { "metric": "firstCpuIdle", "budget": 4000, "tolerance": 1000 }, { "metric": "timeToInteractive", "budget": 5000, "tolerance": 1000 }, { "metric": "firstMeaningfulPaint", "budget": 2000, "tolerance": 500 } ] }, { "cpuThrottling": 1, "connectionType": "wifi", "requests": [ { "resourceType": "total", "budget": 100 }, { "resourceType": "thirdParty", "budget": 0 } ] } ] }Result:
budgets.json API
budgets.json format:
<budget><Object>. Attributes:cpuThrottling:
<cpuThrottling>(required)connectionType:
<connectionType>(required)pageWeight:
<Array<pageWeightBudget>>(optional)requests:
<Array<requestBudget>>(optional)timings:
<Array<timingBudget>>(optional)<cpuThrottling><number>. One of1,2,3, or4. This represents 1x, 2x, etc. throttling.<connectionType><string>. One ofslow3G,regular3G,fast3G,slow4G,regular4G, orwifi.<timingMetric><string>. One offirstContentfulPaint,firstCpuIdle,timeToInteractive, orfirstMeaningfulPaint.<string>. One oftotal,document,script,stylesheet,image,media,font,other, orthirdParty.<timingBudget><Object>. Attributes:metric:
<timingMetric>(required)budget:
<number>(required) Time in milliseconds.tolerance:
<number>(optional) Time in milliseconds. If a tolerance is specified, the budget will only fail if the measurement exceeds budget + tolerance.<PageWeightBudget><Object>. Attributes:resourceType:
<resourceType>(required)budget:
<number>(required) Resource size in KB.<RequestBudget><Object>. Attributes:resourceType:
<resourceType>(required)budget:
<number>(required) Number of requests.cc @addyosmani