Skip to content

Commit

Permalink
feat(bench/deno_common): show ns/op (denoland#9915)
Browse files Browse the repository at this point in the history
It's simply the inverse of the rate (ops/s), but it's often useful to look at time per op
  • Loading branch information
AaronO committed Mar 28, 2021
1 parent b112496 commit 7c7a62a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cli/bench/deno_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ function benchSync(name, n, innerLoop) {
const t2 = Date.now();
const dt = (t2 - t1) / 1e3;
const r = n / dt;
const ns = Math.floor(dt / n * 1e9);
console.log(
`${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`,
);
}

Expand Down

0 comments on commit 7c7a62a

Please sign in to comment.