-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathbench.js
124 lines (120 loc) · 4.99 KB
/
bench.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
var Benchmark = require('benchmark');
var _ = require('underscore');
var suite = new Benchmark.Suite;
var execSync = require('child_process').execSync;
function formatNumber(number) {
number = String(number).split('.');
return number[0].replace(/(?=(?:\d{3})+$)(?!\b)/g, ',') +
(number[1] ? '.' + number[1] : '');
}
// add tests
suite
.add('SmallCodon.bf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/SimpleOptimizations/SmallCodon.bf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('IntermediateProtein.bf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/SimpleOptimizations/IntermediateProtein.bf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('FEL.wbf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/libv3/FEL.wbf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('SLAC.wbf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/libv3/SLAC.wbf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('SLAC-partitioned.wbf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/libv3/SLAC-partitioned.wbf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('MEME.wbf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/libv3/MEME.wbf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('BUSTED.wbf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/libv3/BUSTED.wbf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('BUSTED-SRV.wbf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/libv3/BUSTED-SRV.wbf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('RELAX.wbf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/libv3/RELAX.wbf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('FUBAR.wbf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/libv3/FUBAR.wbf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('BGM.wbf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/libv3/BGM.wbf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('CFEL.wbf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/libv3/CFEL.wbf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('FADE.wbf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/libv3/FADE.wbf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('GARD.wbf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/libv3/GARD.wbf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('ABSREL.wbf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/libv3/ABSREL.wbf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
.add('ABSREL-MH.wbf', function() {
execSync("/home/runner/work/hyphy/hyphy/HYPHYMP 'tests/hbltests/libv3/ABSREL-MH.wbf'", (error, stdout, stderr) => {
if (error) { console.log("Error with job = " + error); return;}
if (stderr) {return;}
});
})
// add listeners
.on('cycle', function(event) {
let bench = event.target;
let result = bench.name || (_.isNaN(bench.id) ? bench.id : '<Test #' + bench.id + '>');
let pm = '\xb1';
result += ' x ' + formatNumber(bench.hz.toFixed(bench.hz < 100 ? 6 : 0)) + ' ops/sec ' + pm + bench.stats.rme.toFixed(6) + '% (' + bench.stats.sample.length + ' run' + (bench.stats.sample.length == 1 ? '' : 's') + ' sampled)'
console.log(result);
})
.on('complete', function() {
console.log('Fastest is ' + this.filter('fastest').map('name'));
})
// run async
.run({ 'async': true });