forked from ReactiveX/rxjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
specbuilder.js
34 lines (30 loc) · 1.15 KB
/
specbuilder.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
var benchpress = require('benchpress');
exports.Preset = (function () {
function Preset() {
this.iteration = arguments.length ? Array.prototype.slice.call(arguments) : [1000, 10000];
this.runner = new benchpress.Runner([
benchpress.SeleniumWebDriverAdapter.PROTRACTOR_BINDINGS,
benchpress.Validator.bindTo(benchpress.RegressionSlopeValidator),
benchpress.bind(benchpress.RegressionSlopeValidator.SAMPLE_SIZE).toValue(20),
benchpress.bind(benchpress.RegressionSlopeValidator.METRIC).toValue('scriptTime'),
benchpress.bind(benchpress.Options.FORCE_GC).toValue(false)
]);
}
Preset.prototype.initBrowser = function (browser, url, value) {
browser.ignoreSynchronization = true;
browser.get('http://localhost:8080/perf/macro/' + url + '/index.html?iterations=' + value);
};
Preset.prototype.sampleParameter = function (sampleId, documentId, value) {
return {
id: sampleId,
execute: function () {
$(documentId).click();
},
bindings: [
benchpress.bind(benchpress.Options.SAMPLE_DESCRIPTION).toValue({
iterations: value
})
]};
};
return Preset;
})();