benchmark: use commas in non-csv rate output

PR-URL: https://github.com/nodejs/node/pull/10360
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
pull/10434/head
Brian White 2016-12-20 14:57:28 -05:00 committed by James M Snell
parent c74d9d672e
commit 17eb8fce05
2 changed files with 6 additions and 2 deletions

View File

@ -185,7 +185,9 @@ function formatResult(data) {
conf += ' ' + key + '=' + JSON.stringify(data.conf[key]);
}
return `${data.name}${conf}: ${data.rate}`;
const rate = Math.floor(data.rate)
.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
return `${data.name}${conf}: ${rate}`;
}
function sendResult(data) {

View File

@ -56,7 +56,9 @@ if (format === 'csv') {
conf = conf.replace(/"/g, '""');
console.log(`"${data.name}", "${conf}", ${data.rate}, ${data.time}`);
} else {
console.log(`${data.name} ${conf}: ${data.rate}`);
const rate = Math.floor(data.rate)
.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
console.log(`${data.name} ${conf}: ${rate}`);
}
});