Continuous integration for performance monitoring
minimal setup
npm install perfbench --save
usage
Add to your package.json
"scripts":
use with CI
Add this line in your .travis.yml
scripts: - perfbench http://localhost:3000
metrics measured
- First meaningful paint (1600 ms threshold)
- Speed index metric (1250)
- Time to interactive (2500 ms)
- Total byte weight (1600 Kb)
test conditions
- Network: Regular 3G (750 Kbps)
- Device emulation: Nexus 5X
- CPU: 5x slowdown
configuration
You can also drop a YAML file .perf.yml
in the root of your repository for easier customisation.
All fields are optional.
runs: 2 # average of how many runs (optional, default: 3) fail: false # fail: true only throws a warning (optional, default: true) thresholds: # build will fail if these thresholds are not met (optional, defaults:) - first-meaningful-paint: 1600 - speed-index-metric: 1250 - time-to-interactive: 2500 - total-byte-weight: 1600
custom properties
You can also add custom properties.
Send a user timing performance event from your javascript.
performance
And add the kebabcased key to .perf.yml
thresholds: - page-ready: 1500
event-type
For travis users, if you would like to run perfbench in pull_request
instead of push
,
set event-type
in .perf.yml
event-type: pull_request
like it?
⭐️ this repo
todo
- support multiple urls
license
MIT © siddharthkp