Skip to content

Commit 10b3297

Browse files
mscdexevanlucas
authored andcommitted
benchmark: use commas in non-csv rate output
PR-URL: #10360 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent d33e560 commit 10b3297

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

benchmark/common.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ function formatResult(data) {
185185
conf += ' ' + key + '=' + JSON.stringify(data.conf[key]);
186186
}
187187

188-
return `${data.name}${conf}: ${data.rate}`;
188+
const rate = Math.floor(data.rate)
189+
.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
190+
return `${data.name}${conf}: ${rate}`;
189191
}
190192

191193
function sendResult(data) {

benchmark/run.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ if (format === 'csv') {
5656
conf = conf.replace(/"/g, '""');
5757
console.log(`"${data.name}", "${conf}", ${data.rate}, ${data.time}`);
5858
} else {
59-
console.log(`${data.name} ${conf}: ${data.rate}`);
59+
const rate = Math.floor(data.rate)
60+
.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
61+
console.log(`${data.name} ${conf}: ${rate}`);
6062
}
6163
});
6264

0 commit comments

Comments
 (0)