Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Perf tests for Ember Glimmer implementation using DBMonster test app
/*
Ensure that you have ember-cli installed
Clone https://github.com/wycats/dbmonster
To Run Tests
1. Update version on ember to canary (components/ember#canary) or older versions
2. Run ember build --environment production
3. Run a HTTP server on dist directory, at port 8080
4. Run this file to collect data in _data.json
Notes
- You may also have to replace this.get('attrs.db') to this.get('db').samples in app/components/dbmon-database.js
- You may also have to replace {{attrs.db.name}} to {{db.name}} in app/templates/components/dbmon-database.hbs
- Using Ember canary - http://www.ember-cli.com/#using-canary-build-instead-of-release
*/
var browserPerf = require('browser-perf');
var fs = require('fs');
var BROWSER = 'chrome'
browserPerf('http://localhost:8080/', function(err, res) {
if (err) {
console.log(err);
} else {
writeData(res[0])
}
}, {
browsers: [{
browserName: BROWSER
}],
selenium: 'http://localhost:9515'
});
function writeData(res) {
var version = require('./bower.json').dependencies.ember;
var data = {};
try {
data = JSON.parse(fs.readFileSync('_data.json'));
} catch (e) {}
if (typeof data[BROWSER] === 'undefined') {
data[BROWSER] = {};
}
if (typeof data[BROWSER][version] === 'undefined') {
data[BROWSER][version] = {};
}
for (var metric in res) {
if (typeof data[BROWSER][version][metric] === 'undefined') {
data[BROWSER][version][metric] = [];
}
data[BROWSER][version][metric].push(res[metric]);
}
fs.writeFileSync('_data.json', JSON.stringify(data));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment