@indutny/bencher 1.1.4 → 1.1.5
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 +4 -2
- package/package.json +1 -1
package/dist/bin/bencher.js
CHANGED
|
@@ -36,6 +36,7 @@ const BOLD = 1;
|
|
|
36
36
|
const ITALIC = 3;
|
|
37
37
|
// Go back to previous line, clear the line
|
|
38
38
|
const PREV_LINE = '\x1b[F\x1b[K';
|
|
39
|
+
// From https://github.com/mayuki/Kurukuru
|
|
39
40
|
const SPINNER = ['⠋', '⠙', '⠸', '⠴', '⠦', '⠇'];
|
|
40
41
|
const TICK_FREQUENCY = 1 / 4;
|
|
41
42
|
// t-distribution value for large sample count and p=0.001
|
|
@@ -113,7 +114,8 @@ async function main() {
|
|
|
113
114
|
const { ops, maxError, usedSamples } = run(m, {
|
|
114
115
|
onTick,
|
|
115
116
|
});
|
|
116
|
-
const stats =
|
|
117
|
+
const stats = '\x1b[90m' +
|
|
118
|
+
style(`(±${nice(maxError)}, p=${P_VALUE}, n=${usedSamples})`, ITALIC);
|
|
117
119
|
(0, fs_1.writeSync)(process.stdout.fd, `${PREV_LINE}${paddedName} ${nice(ops)} ops/sec ${stats}\n`);
|
|
118
120
|
}
|
|
119
121
|
}
|
|
@@ -246,7 +248,7 @@ function style(text, code) {
|
|
|
246
248
|
function nice(n) {
|
|
247
249
|
let result = n.toFixed(1);
|
|
248
250
|
for (let i = result.length - 5; i > 0; i -= 3) {
|
|
249
|
-
result = result.slice(0, i) +
|
|
251
|
+
result = result.slice(0, i) + '’' + result.slice(i);
|
|
250
252
|
}
|
|
251
253
|
return result;
|
|
252
254
|
}
|