@naturalcycles/bench-lib 4.6.0 → 4.8.0
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/asciiChart.util.js +3 -1
- package/dist/bench.util.d.ts +0 -1
- package/dist/bench.util.js +2 -2
- package/dist/cannon.util.js +4 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +0 -2
- package/dist/vendor/asciichart.js +0 -1
- package/package.json +6 -5
package/dist/asciiChart.util.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { _arrayFilled } from '@naturalcycles/js-lib/array/range.js';
|
|
2
|
-
import { formatNumber } from './bench.util.js';
|
|
3
2
|
import { asciiColor, asciiPlot } from './vendor/asciichart.js';
|
|
4
3
|
const colors = [
|
|
5
4
|
asciiColor.blue,
|
|
@@ -38,3 +37,6 @@ function colored(char, color) {
|
|
|
38
37
|
return char;
|
|
39
38
|
return color + char + asciiColor.reset;
|
|
40
39
|
}
|
|
40
|
+
function formatNumber(n) {
|
|
41
|
+
return Math.round(n).toLocaleString('en-US');
|
|
42
|
+
}
|
package/dist/bench.util.d.ts
CHANGED
|
@@ -7,4 +7,3 @@ export declare function runBenchScript(opt: RunBenchOptions): void;
|
|
|
7
7
|
* Only DeferredFunctions are allowed, because of: https://github.com/bestiejs/benchmark.js/issues/111
|
|
8
8
|
*/
|
|
9
9
|
export declare function runBench(opt: RunBenchOptions): Promise<HertzMap>;
|
|
10
|
-
export declare function formatNumber(n: number): string;
|
package/dist/bench.util.js
CHANGED
|
@@ -43,7 +43,7 @@ export async function runBench(opt) {
|
|
|
43
43
|
// })
|
|
44
44
|
fs2.ensureDir(reportDirPath);
|
|
45
45
|
const summaryJsonPath = `${reportDirPath}/${name}.json`;
|
|
46
|
-
fs2.
|
|
46
|
+
fs2.writePrettyJson(summaryJsonPath, avg);
|
|
47
47
|
console.log(`saved ${dimGrey(summaryJsonPath)}`);
|
|
48
48
|
}
|
|
49
49
|
// Vega plots are currently disabled
|
|
@@ -137,7 +137,7 @@ function printComparisonTable(avg, baselineName) {
|
|
|
137
137
|
}
|
|
138
138
|
console.log();
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
function formatNumber(n) {
|
|
141
141
|
return Math.round(n).toLocaleString('en-US');
|
|
142
142
|
}
|
|
143
143
|
function formatTime(hz) {
|
package/dist/cannon.util.js
CHANGED
|
@@ -63,11 +63,11 @@ export async function runCannon(profiles, optInput = {}) {
|
|
|
63
63
|
console.table(summaries);
|
|
64
64
|
if (opt.writeSummary) {
|
|
65
65
|
const summaryJsonPath = `${reportDirPath}/${opt.name}.summary.json`;
|
|
66
|
-
fs2.
|
|
66
|
+
fs2.writePrettyJson(summaryJsonPath, summaries);
|
|
67
67
|
console.log(`saved ${dimGrey(summaryJsonPath)}`);
|
|
68
68
|
}
|
|
69
69
|
if (opt.writeRawSummary) {
|
|
70
|
-
fs2.
|
|
70
|
+
fs2.writePrettyJson(`${reportDirPath}/${opt.name}.rawSummary.json`, resultByProfile);
|
|
71
71
|
}
|
|
72
72
|
// if (opt.writePlots) {
|
|
73
73
|
// await writePlotFiles(opt, summaries)
|
|
@@ -76,6 +76,8 @@ export async function runCannon(profiles, optInput = {}) {
|
|
|
76
76
|
}
|
|
77
77
|
async function runCannonProfile(profileName, serverFactory, opt) {
|
|
78
78
|
const { runs, connections, pipelining, duration, cooldown, host, renderProgressBar, renderResultsTable, renderLatencyTable, silent, } = opt;
|
|
79
|
+
// `as any` suppresses TS7016 (autocannon has no type declarations)
|
|
80
|
+
// oxlint-disable-next-line typescript/no-unnecessary-type-assertion
|
|
79
81
|
const { default: autocannon } = await import('autocannon');
|
|
80
82
|
const server = await serverFactory();
|
|
81
83
|
await new Promise(resolve => server.listen(0, resolve));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './bench.model.js';
|
|
1
|
+
export type * from './bench.model.js';
|
|
2
2
|
export * from './bench.profles.js';
|
|
3
3
|
export * from './bench.util.js';
|
|
4
|
-
export * from './cannon.model.js';
|
|
4
|
+
export type * from './cannon.model.js';
|
|
5
5
|
export * from './cannon.profiles.js';
|
|
6
6
|
export * from './cannon.util.js';
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -10,15 +10,16 @@
|
|
|
10
10
|
"tslib": "^2"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
+
"@naturalcycles/dev-lib": "0.0.0",
|
|
13
14
|
"@types/benchmark": "^2",
|
|
14
15
|
"@types/cors": "^2",
|
|
15
16
|
"@types/express": "^5",
|
|
16
|
-
"@types/node": "^
|
|
17
|
+
"@types/node": "^26",
|
|
18
|
+
"typescript": "^7",
|
|
17
19
|
"express": "^5",
|
|
18
20
|
"fastify": "^5",
|
|
19
21
|
"helmet": "^8",
|
|
20
|
-
"nanoid": "^
|
|
21
|
-
"@naturalcycles/dev-lib": "20.20.0"
|
|
22
|
+
"nanoid": "^6"
|
|
22
23
|
},
|
|
23
24
|
"exports": {
|
|
24
25
|
".": "./dist/index.js"
|
|
@@ -37,9 +38,9 @@
|
|
|
37
38
|
"directory": "packages/bench-lib"
|
|
38
39
|
},
|
|
39
40
|
"engines": {
|
|
40
|
-
"node": ">=
|
|
41
|
+
"node": ">=26.12.1"
|
|
41
42
|
},
|
|
42
|
-
"version": "4.
|
|
43
|
+
"version": "4.8.0",
|
|
43
44
|
"description": "Benchmarking library, based on Benchmark.js and Autocannon",
|
|
44
45
|
"author": "Natural Cycles Team",
|
|
45
46
|
"license": "MIT",
|