Browser Performance regression suite
PerfJankie is a tool to monitor smoothness and responsiveness of websites and Cordova/Hybrid apps over time. It runs performance tests using browser-perf and saves the results in a CouchDB server. It also has a dashboard that displays graphs of the performance metrics collected over time that you help identify performance trends, or locate a single commit that can slow down a site.
After running the tests, navigate to the following url to see the results dashboard.
Checking for performance regressions is hard. Though most modern browsers have excellent performance measurement tools, it is hard for a developer to check these tools for every commit. Just as unit tests check for regressions in functionality, perfjankie will help with checking regressions in browser rendering performance when integrated into systems like Travis or Jenkins.
The results dashboard
Perfjankie requires Selenium as the driver to run tests and CouchDB to store the results. Since this is based on browser-perf, look at setting up browser-perf for more information.
Perfjankie can be used as a node module, from the command line, or as a Grunt task and can be installed from npm using
npm install perfjankie.
The API call looks like the following
var perfjankie = require'perfjankie';perfjankie"url": "" // URL of the page that you would like to test./* The next set of values identify the test */name: "Component or Webpage Name" // A friendly name for the URL. This is shown as component name in the dashboardsuite: "optional suite name" // Displayed as the title in the dashboard. Only 1 suite name for all componentstime: getTime // Used to sort the data when displaying graph. Can be the time when a commit was maderun: "commit#Hash" // A hash for the commit, displayed in the x-axis in the dashboardrepeat: 3 // Run the tests 3 times. Default is 1 time/* Identifies where the data and the dashboard are saved */couch:server: ''database: 'performance'updateSite: !processenvCI // If true, updates the couchApp that shows the dashboard. Set to false in when running Continuous integration, run this the first time using command line.onlyUpdateSite: false // No data to upload, just update the site. Recommended to do from dev box as couchDB instance may require special access to create views.// The callback function, err is falsy if all of the following happen// 1. Browsers perf tests ran// 2. Data has been saved in couchDB// err is not falsy even if update site fails./* OPTIONS PASSED TO BROWSER-PERF */// Properties identifying the test environment */browsers: // This can also be a ["chrome", "firefox"] or "chrome,firefox"browserName: "chrome"version: 32platform: "Windows 8.1"// See browser perf browser configuration for all options.selenium:hostname: "ondemand.saucelabs.com" // or localhost or hub.browserstack.comport: 80BROWSERSTACK_USERNAME: processenvBROWSERSTACK_USERNAME // If using browserStackBROWSERSTACK_KEY: processenvBROWSERSTACK_KEY // If using browserStack, this is automatically added to browsers objectSAUCE_USERNAME: processenvSAUCE_USERNAME // If using SaucelabsSAUCE_ACCESSKEY: processenvSAUCE_ACCESSKEY // If using Saucelabs/* A way to log the information - can be bunyan, or grunt logs. */log: // Expects the following methods,fatal: gruntfailfatalbindgruntfailerror: gruntfail.warnbindgruntfailwarn: grunt.log.errorbindgrunt.loginfo: grunt.logokbindgrunt.logdebug: gruntverbosewritelnbindgruntverbosetrace: grunt.logdebugbindgrunt.log;
Other options that can be passed include
preScriptFile, etc. Note that most of these options are similar to the options passed to browser-perf. Refer to the browser-perf options for a mode detailed explanation.
To run perfjankie as a Grunt task, simple load task using
grunt.loadNpmTasks('perfjankie');, define a
perfjankie task and pass in all the options from above as options to the Grunt task. Here is an example.
perfjankie --help to see a list of all the options.
Quick Note - to only update site the first time, run the following from the command line.
$ perfjankie --config-file=local.config.json --only-update-site
The config file can contain server configuration and can look like this.
You can also host the HTML/CSS/JS for displaying the results dashboard on not on CouchDB, but a different static server, possibly behind a CDN. In such cases,
This will ensure that all requests for data are made to the other CouchDB server. Also ensure that the CouchDB server has CORS turned on.
If you have older data and want to move to the latest release of perfjankie, you may also have to migrate your data. You can migrate from older version of a database to a newer version using
$ perfjankie --config-file=local.config.json --migrate=newDatabaseName
This simply transforms all the old data into a format that will work with the newer version of perfjankie. Your version of the database is stored under a document called
version, and the version supported by your installed version of perfjankie is the key
dbVersion in the
Perfjankie measures page rendering times. It collects metrics like frame times, page load time, first paint time, scroll time, etc. It can be used on