Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
benchmark: keep decimals in results
Some benchmarks' results are small values, so keeping decimals when
running them manually (not comparing) can be helpful.

PR-URL: #10559
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
mscdex committed Jan 5, 2017
commit 7889416b8a93b70fbc1ebfe65b8918f84216c347
5 changes: 3 additions & 2 deletions benchmark/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,9 @@ function formatResult(data) {
conf += ' ' + key + '=' + JSON.stringify(data.conf[key]);
}

const rate = Math.floor(data.rate)
.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
var rate = data.rate.toString().split('.');
rate[0] = rate[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
rate = (rate[1] ? rate.join('.') : rate[0]);
return `${data.name}${conf}: ${rate}`;
}

Expand Down
5 changes: 3 additions & 2 deletions benchmark/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ if (format === 'csv') {
conf = conf.replace(/"/g, '""');
console.log(`"${data.name}", "${conf}", ${data.rate}, ${data.time}`);
} else {
const rate = Math.floor(data.rate)
.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
var rate = data.rate.toString().split('.');
rate[0] = rate[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
rate = (rate[1] ? rate.join('.') : rate[0]);
console.log(`${data.name} ${conf}: ${rate}`);
}
});
Expand Down