Skip to content

Commit

Permalink
benchmark: use commas in non-csv rate output
Browse files Browse the repository at this point in the history
PR-URL: #10360
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
mscdex authored and evanlucas committed Jan 4, 2017
1 parent d33e560 commit 10b3297
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion benchmark/common.js
Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion benchmark/run.js
Expand Up @@ -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}`);
}
});

Expand Down

0 comments on commit 10b3297

Please sign in to comment.