mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
feat(bench/deno_common): show ns/op (#9915)
It's simply the inverse of the rate (ops/s), but it's often useful to look at time per op
This commit is contained in:
parent
b11249647f
commit
7c7a62a7f8
1 changed files with 2 additions and 1 deletions
|
@ -7,9 +7,10 @@ function benchSync(name, n, innerLoop) {
|
||||||
const t2 = Date.now();
|
const t2 = Date.now();
|
||||||
const dt = (t2 - t1) / 1e3;
|
const dt = (t2 - t1) / 1e3;
|
||||||
const r = n / dt;
|
const r = n / dt;
|
||||||
|
const ns = Math.floor(dt / n * 1e9);
|
||||||
console.log(
|
console.log(
|
||||||
`${name}:${" ".repeat(20 - name.length)}\t` +
|
`${name}:${" ".repeat(20 - name.length)}\t` +
|
||||||
`n = ${n}, dt = ${dt.toFixed(3)}s, r = ${r.toFixed(0)}/s`,
|
`n = ${n}, dt = ${dt.toFixed(3)}s, r = ${r.toFixed(0)}/s, t = ${ns}ns/op`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue