Documentation / Performance Budget

Performance Budget

Performance budget

Have you heard of a performance budget? If not, please go read these excellent posts by Tim Kadlec. Don’t worry we will be here when you get back. Setting a performance budget and Fast enough. You should also read Daniel Malls How to make a performance budget. Welcome back, let’s continue the setup of performance budgets. :)

How it works

When you run configured with a budget, the script will exit with a exit status > 0 if the budget fails. It will log all budget items regardless if they pass or fail and generate a HTML report.

The log will look something like this:

[2016-10-24 10:53:01] Failing budget pagexray.pageSummary.transferSize for with value 184.7 KB max limit 97.7 KB
[2016-10-24 10:53:01] Failing budget pagexray.pageSummary.contentTypes.image.transferSize for with value 157.3 KB max limit 97.7 KB
[2016-10-24 10:53:01] Failing budget for with value 215 max limit 200
[2016-10-24 10:53:01] Failing budget for with value 11 max limit 10
[2016-10-24 10:53:01] Budget: 8 working and 4 failing tests

The report looks like this. Example of the budget

Now let’s see how you configure budgets.

The budget file

The current version can handle min/max values and works on the internal data structure.

You can read more about the metrics/data structure in the metrics section.

  "browsertime.pageSummary": [{
    "metric": "statistics.timings.firstPaint.median",
    "max": 1000
    }, {
    "metric": "statistics.visualMetrics.FirstVisualChange.median",
    "max": 1000
  "coach.pageSummary": [{
    "metric": "advice.performance.score",
    "min": 75
  }, {
    "metric": "",
    "max": 200
  }, {
    "metric": "",
    "max": 10
  }, {
    "metric": "",
    "max": 0
  }, {
    "metric": "",
    "max": 5
  "pagexray.pageSummary": [{
    "metric": "transferSize",
    "max": 100000
  }, {
    "metric": "requests",
    "max": 20
  }, {
    "metric": "missingCompression",
    "max": 0
  }, {
    "metric": "contentTypes.css.requests",
    "max": 1
  }, {
    "metric": "contentTypes.image.transferSize",
    "max": 100000
    "metric": "documentRedirects",

Then run it like this:

$ --budget.configPath myBudget.json -b chrome -n 11

And if the budget fails the exit status will be > 0. You can also choose to report the budget as JUnitXML (Jenkins) or TAP.


You can output a JUnit XML file from the budget result like this.

$ --budget.configPath myBudget.json --budget.output junit -b chrome -n 5

It will create a junit.xml in the outputFolder.


If you would instead like to use TAP, you can do so like this:

$ --budget.configPath myBudget.json --budget.output tap -b chrome -n 5

It will create a budget.tap in the outputFolder.