refactor(perf): introduce benchpress2

Major changes:
- make API more reusable
- format output nicely
- only force gc if needed

Regarding forcing gc:
Forcing gc can change script execution time.
We now don't force gc at first and ignore results where gc happens during script execution.
When we ignored too many results, we switch to forcing gc.

Closes #339
This commit is contained in:
Tobias Bosch
2014-12-29 15:36:29 -08:00
parent 53906e484a
commit 6f303121c6
16 changed files with 572 additions and 285 deletions
@@ -1,25 +1,44 @@
"use strict";
var util = require('../../../../tools/perf/util.js');
var benchpress = require('../../../../tools/benchpress/benchpress.js');
describe('ng1.x compiler benchmark', function () {
var URL = 'benchmarks_external/web/compiler/compiler_benchmark.html';
afterEach(util.verifyNoErrors);
afterEach(benchpress.verifyNoBrowserErrors);
it('should log withBinding stats', function() {
browser.get(URL);
util.runClickBenchmark({
runClickTimeBenchmark({
buttons: ['#compileWithBindings'],
name: browser.params.lang+'.ng1.compile.withBindings'
logId: 'ng1.compile.withBindings'
});
});
it('should log noBindings stats', function() {
util.runClickBenchmark({
browser.get(URL);
runClickTimeBenchmark({
buttons: ['#compileNoBindings'],
name: browser.params.lang+'.ng1.compile.noBindings'
logId: 'ng1.compile.noBindings'
});
});
});
function runClickTimeBenchmark(config) {
var buttons = config.buttons.map(function(selector) {
return $(selector);
});
var timeParams = browser.params.timeBenchmark;
benchpress.runTimeBenchmark({
sampleSize: timeParams.sampleSize,
targetCoefficientOfVariation: timeParams.targetCoefficientOfVariation,
timeout: timeParams.timeout,
metrics: timeParams.metrics,
logId: browser.params.lang+'.'+config.logId
}, function() {
buttons.forEach(function(button) {
button.click();
});
});
}
@@ -1,18 +1,36 @@
"use strict";
var util = require('../../../../tools/perf/util.js');
var benchpress = require('../../../../tools/benchpress/benchpress.js');
describe('ng1.x tree benchmark', function () {
var URL = 'benchmarks_external/web/tree/tree_benchmark.html';
afterEach(util.verifyNoErrors);
afterEach(benchpress.verifyNoBrowserErrors);
it('should log the stats', function() {
browser.get(URL);
util.runClickBenchmark({
runClickTimeBenchmark({
buttons: ['#destroyDom', '#createDom'],
name: browser.params.lang+'.ng1.tree'
logId: 'ng1.tree'
});
});
});
function runClickTimeBenchmark(config) {
var buttons = config.buttons.map(function(selector) {
return $(selector);
});
var timeParams = browser.params.timeBenchmark;
benchpress.runTimeBenchmark({
sampleSize: timeParams.sampleSize,
targetCoefficientOfVariation: timeParams.targetCoefficientOfVariation,
timeout: timeParams.timeout,
metrics: timeParams.metrics,
logId: browser.params.lang+'.'+config.logId
}, function() {
buttons.forEach(function(button) {
button.click();
});
});
}