Skip to content

Commit

Permalink
Better printer
Browse files Browse the repository at this point in the history
  • Loading branch information
colinhacks committed May 16, 2024
1 parent 5f86de6 commit 9f20922
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/benchmarks/benchUtil.mts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ function toFixed(val: number) {

export function toTable(bench: Bench) {
const sorted = bench.tasks.sort((a, b) => a.result!.mean - b.result!.mean);
const fastest = sorted[0];
// const fastest = sorted[0];
const slowest = sorted[sorted.length - 1];

const table = new Table({
columns: [
Expand All @@ -51,10 +52,10 @@ export function toTable(bench: Bench) {
table.addRow({
name: task.name,
summary:
task === sorted[0]
? "fastest"
: (task.result!.mean / fastest.result!.mean).toFixed(3) +
`x slower than ${fastest.name}`,
task === slowest
? "slowest"
: (task.result!.hz / slowest.result!.hz).toFixed(3) +
`x faster than ${slowest.name}`,
"ops/sec": formatNumber(task.result!.hz) + " ops/sec",
"time/op": formatNumber(task.result!.mean / 1000) + "s",
margin: "±" + task.result!.rme.toFixed(2) + "%",
Expand Down

0 comments on commit 9f20922

Please sign in to comment.