Skip to content

Commit 1b9331a

Browse files
authored
Added relative column to bench (#33)
1 parent 2baeec9 commit 1b9331a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/bench.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ function showResults(name, benchmarkResults) {
1010
info(`Results for ${name}`);
1111

1212
let table = new Table({
13-
head: ["NAME", "OPS/SEC", "RELATIVE MARGIN OF ERROR", "SAMPLE SIZE"]
13+
head: ["NAME", "OPS/SEC", "RELATIVE", "RELATIVE MARGIN OF ERROR", "SAMPLE SIZE"]
1414
});
1515

16+
let baseline = benchmarkResults[0].target.hz;
17+
1618
benchmarkResults.forEach(result => {
19+
let value = result.target.hz;
20+
let relative = (baseline / value).toFixed(0);
1721
table.push([
1822
result.target.name,
1923
result.target.hz.toLocaleString("en-US", { maximumFractionDigits: 0 }),
24+
baseline === value ? '...' : colors.red(`${relative}x slower`),
2025
${result.target.stats.rme.toFixed(2)}%`,
2126
result.target.stats.sample.length
2227
]);

0 commit comments

Comments
 (0)