summaryrefslogtreecommitdiff
path: root/cli/bench/deno_common.js
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2021-03-28 05:17:06 +0200
committerGitHub <noreply@github.com>2021-03-27 23:17:06 -0400
commit7c7a62a7f851df42007332585701ea5a4691aa1a (patch)
tree4619670bfb9cbd1ddb1597d046ab4bad68356b33 /cli/bench/deno_common.js
parentb11249647fa14e482881fd22446dbd8b0cbac27c (diff)
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
Diffstat (limited to 'cli/bench/deno_common.js')
-rw-r--r--cli/bench/deno_common.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/cli/bench/deno_common.js b/cli/bench/deno_common.js
index dc6e29f42..831c26cfa 100644
--- a/cli/bench/deno_common.js
+++ b/cli/bench/deno_common.js
@@ -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`,
);
}