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:
@@ -1,26 +1,44 @@
|
||||
"use strict";
|
||||
var util = require('../../../../tools/perf/util.js');
|
||||
var benchpress = require('../../../../tools/benchpress/benchpress.js');
|
||||
|
||||
describe('ng2 change detection benchmark', function () {
|
||||
|
||||
var URL = 'benchmarks/web/change_detection/change_detection_benchmark.html';
|
||||
|
||||
afterEach(util.verifyNoErrors);
|
||||
afterEach(benchpress.verifyNoBrowserErrors);
|
||||
|
||||
it('should log ng stats', function() {
|
||||
browser.get(URL);
|
||||
util.runClickBenchmark({
|
||||
runClickTimeBenchmark({
|
||||
buttons: ['#ng2DetectChanges'],
|
||||
name: browser.params.lang+'.ng2.changeDetection'
|
||||
logId: 'ng2.changeDetection'
|
||||
});
|
||||
});
|
||||
|
||||
it('should log baseline stats', function() {
|
||||
browser.get(URL);
|
||||
util.runClickBenchmark({
|
||||
runClickTimeBenchmark({
|
||||
buttons: ['#baselineDetectChanges'],
|
||||
name: browser.params.lang+'.baseline.changeDetection'
|
||||
logId: 'baseline.changeDetection'
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
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,26 +1,44 @@
|
||||
"use strict";
|
||||
var util = require('../../../../tools/perf/util.js');
|
||||
var benchpress = require('../../../../tools/benchpress/benchpress.js');
|
||||
|
||||
describe('ng2 compiler benchmark', function () {
|
||||
|
||||
var URL = 'benchmarks/web/compiler/compiler_benchmark.html';
|
||||
|
||||
afterEach(util.verifyNoErrors);
|
||||
afterEach(benchpress.verifyNoBrowserErrors);
|
||||
|
||||
it('should log withBindings stats', function() {
|
||||
browser.get(URL);
|
||||
util.runClickBenchmark({
|
||||
runClickTimeBenchmark({
|
||||
buttons: ['#compileWithBindings'],
|
||||
name: browser.params.lang+'.ng2.compile.withBindings'
|
||||
logId: 'ng2.compile.withBindings'
|
||||
});
|
||||
});
|
||||
|
||||
it('should log noBindings stats', function() {
|
||||
browser.get(URL);
|
||||
util.runClickBenchmark({
|
||||
runClickTimeBenchmark({
|
||||
buttons: ['#compileNoBindings'],
|
||||
name: browser.params.lang+'.ng2.compile.noBindings'
|
||||
logId: 'ng2.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,42 +1,60 @@
|
||||
"use strict";
|
||||
var util = require('../../../../tools/perf/util.js');
|
||||
var benchpress = require('../../../../tools/benchpress/benchpress.js');
|
||||
|
||||
describe('ng2 di benchmark', function () {
|
||||
|
||||
var URL = 'benchmarks/web/di/di_benchmark.html';
|
||||
|
||||
afterEach(util.verifyNoErrors);
|
||||
afterEach(benchpress.verifyNoBrowserErrors);
|
||||
|
||||
it('should log the stats for getByToken', function() {
|
||||
browser.get(URL);
|
||||
util.runClickBenchmark({
|
||||
runClickTimeBenchmark({
|
||||
buttons: ['#getByToken'],
|
||||
name: browser.params.lang+'.ng2.di.getByToken'
|
||||
logId: 'ng2.di.getByToken'
|
||||
});
|
||||
});
|
||||
|
||||
it('should log the stats for getByKey', function() {
|
||||
browser.get(URL);
|
||||
util.runClickBenchmark({
|
||||
runClickTimeBenchmark({
|
||||
buttons: ['#getByKey'],
|
||||
name: browser.params.lang+'.ng2.di.getByKey'
|
||||
logId: 'ng2.di.getByKey'
|
||||
});
|
||||
});
|
||||
|
||||
it('should log the stats for getChild', function() {
|
||||
browser.get(URL);
|
||||
util.runClickBenchmark({
|
||||
runClickTimeBenchmark({
|
||||
buttons: ['#getChild'],
|
||||
name: browser.params.lang+'.ng2.di.getChild'
|
||||
logId: 'ng2.di.getChild'
|
||||
});
|
||||
});
|
||||
|
||||
it('should log the stats for instantiate', function() {
|
||||
browser.get(URL);
|
||||
util.runClickBenchmark({
|
||||
runClickTimeBenchmark({
|
||||
buttons: ['#instantiate'],
|
||||
name: browser.params.lang+'.ng2.di.instantiate'
|
||||
logId: 'ng2.di.instantiate'
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
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,26 +1,44 @@
|
||||
"use strict";
|
||||
var util = require('../../../../tools/perf/util.js');
|
||||
var benchpress = require('../../../../tools/benchpress/benchpress.js');
|
||||
|
||||
describe('ng2 element injector benchmark', function () {
|
||||
|
||||
var URL = 'benchmarks/web/element_injector/element_injector_benchmark.html';
|
||||
|
||||
afterEach(util.verifyNoErrors);
|
||||
afterEach(benchpress.verifyNoBrowserErrors);
|
||||
|
||||
it('should log the stats for instantiate', function() {
|
||||
browser.get(URL);
|
||||
util.runClickBenchmark({
|
||||
runClickTimeBenchmark({
|
||||
buttons: ['#instantiate'],
|
||||
name: browser.params.lang+'.ng2.elementInjector.instantiate'
|
||||
logId: 'ng2.elementInjector.instantiate'
|
||||
});
|
||||
});
|
||||
|
||||
it('should log the stats for instantiateDirectives', function() {
|
||||
browser.get(URL);
|
||||
util.runClickBenchmark({
|
||||
runClickTimeBenchmark({
|
||||
buttons: ['#instantiateDirectives'],
|
||||
name: browser.params.lang+'.ng2.elementInjector.instantiateDirectives'
|
||||
logId: 'ng2.elementInjector.instantiateDirectives'
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
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,26 +1,44 @@
|
||||
"use strict";
|
||||
var util = require('../../../../tools/perf/util.js');
|
||||
var benchpress = require('../../../../tools/benchpress/benchpress.js');
|
||||
|
||||
describe('ng2 tree benchmark', function () {
|
||||
|
||||
var URL = 'benchmarks/web/tree/tree_benchmark.html';
|
||||
|
||||
afterEach(util.verifyNoErrors);
|
||||
afterEach(benchpress.verifyNoBrowserErrors);
|
||||
|
||||
it('should log the ng stats', function() {
|
||||
browser.get(URL);
|
||||
util.runClickBenchmark({
|
||||
runClickTimeBenchmark({
|
||||
buttons: ['#ng2DestroyDom', '#ng2CreateDom'],
|
||||
name: browser.params.lang+'.ng2.tree'
|
||||
logId: 'ng2.tree'
|
||||
});
|
||||
});
|
||||
|
||||
it('should log the baseline stats', function() {
|
||||
browser.get(URL);
|
||||
util.runClickBenchmark({
|
||||
runClickTimeBenchmark({
|
||||
buttons: ['#baselineDestroyDom', '#baselineCreateDom'],
|
||||
name: browser.params.lang+'.baseline.tree'
|
||||
logId: 'baseline.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();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user