@naturalcycles/bench-lib 1.6.7 → 1.6.8
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/bench.util.js +4 -4
- package/dist/cannon.util.js +6 -6
- package/package.json +1 -1
package/dist/bench.util.js
CHANGED
|
@@ -45,18 +45,18 @@ async function runBench(opt) {
|
|
|
45
45
|
// names.forEach(name => {
|
|
46
46
|
// summary[name] = results.hz.map(map => map[name]!)
|
|
47
47
|
// })
|
|
48
|
-
|
|
48
|
+
nodejs_lib_1.fs2.ensureDir(reportDirPath);
|
|
49
49
|
const summaryJsonPath = `${reportDirPath}/${name}.json`;
|
|
50
|
-
|
|
50
|
+
nodejs_lib_1.fs2.writeJson(summaryJsonPath, avg, { spaces: 2 });
|
|
51
51
|
console.log(`saved ${(0, nodejs_lib_1.dimGrey)(summaryJsonPath)}`);
|
|
52
52
|
}
|
|
53
53
|
if (writePlot) {
|
|
54
|
-
|
|
54
|
+
nodejs_lib_1.fs2.ensureDir(reportDirPath);
|
|
55
55
|
const spec = benchResultsToVegaSpec(avg);
|
|
56
56
|
const view = new vega_1.default.View(vega_1.default.parse(spec), { renderer: 'none' });
|
|
57
57
|
const svg = await view.toSVG();
|
|
58
58
|
const plotPath = `${reportDirPath}/${name}.svg`;
|
|
59
|
-
|
|
59
|
+
nodejs_lib_1.fs2.writeFile(plotPath, svg);
|
|
60
60
|
console.log(`saved ${(0, nodejs_lib_1.dimGrey)(plotPath)}`);
|
|
61
61
|
}
|
|
62
62
|
if (asciiPlot) {
|
package/dist/cannon.util.js
CHANGED
|
@@ -52,7 +52,7 @@ async function runCannon(profiles, optInput = {}) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
const { reportDirPath } = opt;
|
|
55
|
-
|
|
55
|
+
nodejs_lib_1.fs2.ensureDir(reportDirPath);
|
|
56
56
|
const resultByProfile = {};
|
|
57
57
|
const summaries = [];
|
|
58
58
|
for await (const profileName of Object.keys(profiles)) {
|
|
@@ -66,11 +66,11 @@ async function runCannon(profiles, optInput = {}) {
|
|
|
66
66
|
console.table(summaries);
|
|
67
67
|
if (opt.writeSummary) {
|
|
68
68
|
const summaryJsonPath = `${reportDirPath}/${opt.name}.summary.json`;
|
|
69
|
-
|
|
69
|
+
nodejs_lib_1.fs2.writeJson(summaryJsonPath, summaries, { spaces: 2 });
|
|
70
70
|
console.log(`saved ${(0, nodejs_lib_1.dimGrey)(summaryJsonPath)}`);
|
|
71
71
|
}
|
|
72
72
|
if (opt.writeRawSummary) {
|
|
73
|
-
|
|
73
|
+
nodejs_lib_1.fs2.writeJson(`${reportDirPath}/${opt.name}.rawSummary.json`, resultByProfile, { spaces: 2 });
|
|
74
74
|
}
|
|
75
75
|
if (opt.writePlots) {
|
|
76
76
|
await writePlotFiles(opt, summaries);
|
|
@@ -134,7 +134,7 @@ function toSummary(name, result) {
|
|
|
134
134
|
}
|
|
135
135
|
async function writePlotFiles(opt, summaries) {
|
|
136
136
|
const { reportDirPath, name } = opt;
|
|
137
|
-
|
|
137
|
+
nodejs_lib_1.fs2.ensureDir(reportDirPath);
|
|
138
138
|
let fields = ['rpsAvg', 'latencyAvg', 'latency50', 'latency90', 'latency99', 'throughputAvg'];
|
|
139
139
|
if (!opt.includeLatencyPercentiles) {
|
|
140
140
|
fields = fields.filter(f => !f.startsWith('latency') || f === 'latencyAvg');
|
|
@@ -146,9 +146,9 @@ async function writePlotFiles(opt, summaries) {
|
|
|
146
146
|
// generate a static SVG image
|
|
147
147
|
const svg = await view.toSVG();
|
|
148
148
|
// console.log(svg)
|
|
149
|
-
|
|
149
|
+
nodejs_lib_1.fs2.writeFile(`${reportDirPath}/${name}.${specName}.svg`, svg);
|
|
150
150
|
});
|
|
151
|
-
|
|
151
|
+
nodejs_lib_1.fs2.writeFile(`${reportDirPath}/${name}.md`, mdContent(opt, Object.keys(specs)));
|
|
152
152
|
}
|
|
153
153
|
function autocannonSummaryToVegaSpecs(fields, summaries) {
|
|
154
154
|
// console.log(summary)
|