-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbenchmarks.js
More file actions
46 lines (35 loc) · 1.06 KB
/
benchmarks.js
File metadata and controls
46 lines (35 loc) · 1.06 KB
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
var fs = require('fs');
var path = require('path');
var benchmarksDir = path.join(__dirname, 'benchmarks');
var benchmarks = [];
fs.readdirSync(benchmarksDir).forEach((benchmarkName) => {
var benchmarkDir = path.join(benchmarksDir, benchmarkName);
if (!fs.statSync(benchmarkDir).isDirectory()) {
// Only look at directories
return;
}
var benchmark = {
name: benchmarkName,
dir: benchmarkDir,
benches: [],
createRoute: require(path.join(benchmarkDir, 'createRoute'))
};
benchmarks.push(benchmark);
fs.readdirSync(benchmarkDir).forEach((libName) => {
if (libName === 'util') {
return;
}
var libDir = path.join(benchmarkDir, libName);
if (!fs.statSync(libDir).isDirectory()) {
// Only look at directories
return;
}
var bench = {
dir: libDir,
name: libName,
url: `/${benchmarkName}/${libName}`,
};
benchmark.benches.push(bench);
});
});
module.exports = benchmarks;