Skip to content

Commit 5524908

Browse files
committed
feat: export rps in benchmark results
1 parent 63c5dc5 commit 5524908

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/benchmark.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ export async function benchmark(name, options, fn) {
5252
}
5353

5454
const mean = total / BigInt(count)
55-
let res = `${name} x ${fRps(1e9 / Number(mean))} ops/sec @ ${fTime(mean)}/op`
55+
const rps = 1e9 / Number(mean)
56+
let res = `${name} x ${fRps(rps)} ops/sec @ ${fTime(mean)}/op`
5657
if (fTime(min) !== fTime(max)) res += ` (${fTime(min)}..${fTime(max)})`
5758
console.log(res)
5859

5960
if (gc) for (let i = 0; i < 4; i++) gc()
60-
return { total, count, mean, min, max }
61+
return { rps, total, count, mean, min, max }
6162
}

0 commit comments

Comments
 (0)