Permalink
Browse files

benchmark: use commas in non-csv rate output

PR-URL: #10360
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
1 parent d33e560 commit 10b3297e8f4b98ccef00eff10f0edbe769da7fae @mscdex mscdex committed with evanlucas Dec 20, 2016
Showing with 6 additions and 2 deletions.
  1. +3 −1 benchmark/common.js
  2. +3 −1 benchmark/run.js
View
@@ -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
@@ -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}`);
}
});

0 comments on commit 10b3297

Please sign in to comment.