@c4312/matcha
Version:
A caffeine driven, simple command line for benchmarking
33 lines • 919 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const os_1 = require("os");
exports.csvFactory = {
description: 'Outputs stats as CSV',
start: () => new CsvReporter(process.stdout),
};
class CsvReporter {
constructor(out) {
this.out = out;
out.write(['name', 'hz', 'mean', 'deviation', 'iterations'].join(',') + os_1.EOL);
}
onStartCycle() {
// no-op
}
onFinishCycle(benchmark) {
if (benchmark.error) {
throw benchmark.error;
}
this.out.write([
benchmark.name.replace(/,/g, ' '),
benchmark.hz.toFixed(8),
benchmark.stats.mean.toFixed(8),
benchmark.stats.deviation.toFixed(8),
benchmark.count,
].join(',') + os_1.EOL);
}
onComplete() {
// no-op
}
}
exports.CsvReporter = CsvReporter;
//# sourceMappingURL=csv.js.map