Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2f4577c

Browse filesBrowse files
mscdexItalo A. Casas
authored andcommitted
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>
1 parent 372e3ee commit 2f4577c
Copy full SHA for 2f4577c

File tree

Expand file treeCollapse file tree

2 files changed

+6
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-4
lines changed
Open diff view settings
Collapse file

‎benchmark/common.js‎

Copy file name to clipboardExpand all lines: benchmark/common.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,9 @@ function formatResult(data) {
195195
conf += ' ' + key + '=' + JSON.stringify(data.conf[key]);
196196
}
197197

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

Collapse file

‎benchmark/run.js‎

Copy file name to clipboardExpand all lines: benchmark/run.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ if (format === 'csv') {
5656
conf = conf.replace(/"/g, '""');
5757
console.log(`"${data.name}", "${conf}", ${data.rate}, ${data.time}`);
5858
} else {
59-
const rate = Math.floor(data.rate)
60-
.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
59+
var rate = data.rate.toString().split('.');
60+
rate[0] = rate[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
61+
rate = (rate[1] ? rate.join('.') : rate[0]);
6162
console.log(`${data.name} ${conf}: ${rate}`);
6263
}
6364
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.