@indutny/bencher 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/bencher.js +29 -15
- package/package.json +5 -5
package/dist/bin/bencher.js
CHANGED
|
@@ -97,27 +97,41 @@ async function main() {
|
|
|
97
97
|
if (warmUpDuration <= 0) {
|
|
98
98
|
throw new Error(`${file}: options.warmUpDuration must be positive`);
|
|
99
99
|
}
|
|
100
|
-
const
|
|
100
|
+
const options = {
|
|
101
|
+
duration,
|
|
102
|
+
sweepWidth,
|
|
103
|
+
samples,
|
|
104
|
+
warmUpDuration,
|
|
105
|
+
ignoreOutliers,
|
|
106
|
+
};
|
|
107
|
+
const result = new Array();
|
|
101
108
|
for (const key of Object.keys(m)) {
|
|
102
109
|
if (typeof m[key] === 'function') {
|
|
103
|
-
|
|
110
|
+
result.push({
|
|
111
|
+
file: String(file),
|
|
112
|
+
name: key,
|
|
113
|
+
fn: m[key],
|
|
114
|
+
options,
|
|
115
|
+
});
|
|
104
116
|
}
|
|
105
117
|
}
|
|
106
|
-
return
|
|
107
|
-
name: `${file}/${fn.name}`,
|
|
108
|
-
options: {
|
|
109
|
-
duration,
|
|
110
|
-
sweepWidth,
|
|
111
|
-
samples,
|
|
112
|
-
warmUpDuration,
|
|
113
|
-
ignoreOutliers,
|
|
114
|
-
},
|
|
115
|
-
fn,
|
|
116
|
-
}));
|
|
118
|
+
return result;
|
|
117
119
|
}))).flat();
|
|
118
|
-
|
|
120
|
+
modules.sort((a, b) => {
|
|
121
|
+
if (a.name === b.name) {
|
|
122
|
+
return a.file < b.file ? -1 : 1;
|
|
123
|
+
}
|
|
124
|
+
return a.name < b.name ? -1 : 1;
|
|
125
|
+
});
|
|
126
|
+
const maxNameLength = modules.reduce((len, { file, name }) => Math.max(len, file.length + name.length), 0);
|
|
119
127
|
for (const m of modules) {
|
|
120
|
-
const paddedName = BOLD +
|
|
128
|
+
const paddedName = BOLD +
|
|
129
|
+
m.file +
|
|
130
|
+
'/' +
|
|
131
|
+
m.name +
|
|
132
|
+
RESET +
|
|
133
|
+
':' +
|
|
134
|
+
' '.repeat(maxNameLength - m.name.length - m.file.length);
|
|
121
135
|
// Just to reserve the line
|
|
122
136
|
(0, fs_1.writeSync)(process.stdout.fd, '\n');
|
|
123
137
|
let ticks = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indutny/bencher",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Simple benchmarking tool",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bencher": "./dist/bin/bencher.js"
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
"sweep",
|
|
15
15
|
"regression"
|
|
16
16
|
],
|
|
17
|
-
"author": "Fedor Indutny <
|
|
17
|
+
"author": "Fedor Indutny <indutny@reply.codeberg.org>",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "git+https://
|
|
21
|
+
"url": "git+https://codeberg.org/indutny/bencher.git"
|
|
22
22
|
},
|
|
23
23
|
"bugs": {
|
|
24
|
-
"url": "https://
|
|
24
|
+
"url": "https://codeberg.org/indutny/bencher/issues"
|
|
25
25
|
},
|
|
26
|
-
"homepage": "https://
|
|
26
|
+
"homepage": "https://codeberg.org/indutny/bencher#readme",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/yargs": "^17.0.17",
|
|
29
29
|
"@typescript-eslint/eslint-plugin": "^5.47.0",
|