-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
35 lines (29 loc) · 944 Bytes
/
index.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
35
'use strict';
module.exports = function () {
//
// TODO: More than simple tests or whatever.
//
};
var suite = require('./lib/console.bench')();
suite.on('cycle', function cycle(e) {
var details = e.target;
console.log('Finished benchmarking: "%s"', details.name);
console.log('Count (%d), Cycles (%d), Elapsed (%ds), Hz (%d)'
, details.count
, details.cycles
, details.times.elapsed
, details.hz
);
}).on('complete', function completed() {
console.log('Benchmark: "%j" is the fastest.', this.filter('fastest')[0].name);
var that = this;
this.forEach(function (left, i) {
that.forEach(function (right, j) {
var faster = left.hz > right.hz ? left : right;
var slower = left.hz < right.hz ? left : right;
if (left !== right && j > i) {
console.log(' - %s faster than %s by %d', faster.name, slower.name, (faster.hz / slower.hz).toFixed(4));
}
});
});
}).run();