Use Lighthouse for performance budgets

Lighthouse now supports performance budgets. This feature, LightWallet, can be set up in under five minutes and provides feedback on performance metrics and the size and quantity of page resources.
Install Lighthouse #
LightWallet is available in the c…


This content originally appeared on web.dev and was authored by Katie Hempenius

Lighthouse now supports performance budgets. This feature, LightWallet, can be set up in under five minutes and provides feedback on performance metrics and the size and quantity of page resources.

Install Lighthouse

LightWallet is available in the command line version of Lighthouse v5+.

To get started, install Lighthouse:

npm install -g lighthouse

Create a Budget

Create a file named budget.json. In this file add the following JSON:

[
{
"path": "/*",
"timings": [
{
"metric": "interactive",
"budget": 3000
},
{
"metric": "first-meaningful-paint",
"budget": 1000
}
],
"resourceSizes": [
{
"resourceType": "script",
"budget": 125
},
{
"resourceType": "total",
"budget": 300
}
],
"resourceCounts": [
{
"resourceType": "third-party",
"budget": 10
}
]
}
]

This example budget.json file sets five separate budgets:

  • A budget of 3000ms for Time to Interactive.
  • A budget of 1000ms for First Meaningful Paint
  • A budget of 125 KB for the total amount of JavaScript on the page.
  • A budget of 300 KB for the overall size of the page.
  • A budget of 10 requests for the number of requests made to third-party origins.

For a complete list of supported performance metrics and resource types, refer to the Performance Budgets section of the Lighthouse docs.

Run Lighthouse

Run Lighthouse using the --budget-path flag. This flag tells Lighthouse the location of your budget file.

lighthouse https://example.com --budget-path=./budget.json

Note: A budget file does not have to be named budget.json.

View the Results

If LightWallet has been configured correctly, the Lighthouse report will contain a Budgets section within the Performance category.

'Budgets' section of the Lighthouse report

In the JSON version of the Lighthouse report, Lightwallet results can be found within the audit findings for the performance-budget audit.


This content originally appeared on web.dev and was authored by Katie Hempenius


Print Share Comment Cite Upload Translate
APA
Katie Hempenius | Sciencx (2023-04-02T03:09:21+00:00) » Use Lighthouse for performance budgets. Retrieved from https://www.scien.cx/2019/06/14/use-lighthouse-for-performance-budgets/.
MLA
" » Use Lighthouse for performance budgets." Katie Hempenius | Sciencx - Friday June 14, 2019, https://www.scien.cx/2019/06/14/use-lighthouse-for-performance-budgets/
HARVARD
Katie Hempenius | Sciencx Friday June 14, 2019 » Use Lighthouse for performance budgets., viewed 2023-04-02T03:09:21+00:00,<https://www.scien.cx/2019/06/14/use-lighthouse-for-performance-budgets/>
VANCOUVER
Katie Hempenius | Sciencx - » Use Lighthouse for performance budgets. [Internet]. [Accessed 2023-04-02T03:09:21+00:00]. Available from: https://www.scien.cx/2019/06/14/use-lighthouse-for-performance-budgets/
CHICAGO
" » Use Lighthouse for performance budgets." Katie Hempenius | Sciencx - Accessed 2023-04-02T03:09:21+00:00. https://www.scien.cx/2019/06/14/use-lighthouse-for-performance-budgets/
IEEE
" » Use Lighthouse for performance budgets." Katie Hempenius | Sciencx [Online]. Available: https://www.scien.cx/2019/06/14/use-lighthouse-for-performance-budgets/. [Accessed: 2023-04-02T03:09:21+00:00]
rf:citation
» Use Lighthouse for performance budgets | Katie Hempenius | Sciencx | https://www.scien.cx/2019/06/14/use-lighthouse-for-performance-budgets/ | 2023-04-02T03:09:21+00:00
https://github.com/addpipe/simple-recorderjs-demo