diff options
author | 2023-06-26 19:07:00 -0700 | |
---|---|---|
committer | 2023-06-26 19:07:54 -0700 | |
commit | f839cf1ce309959f168066e51edc2e8b0038728e (patch) | |
tree | 19f9da6079ce47e97ee442ae43a0fe9dd94189dd /bench/snippets/crypto.mjs | |
parent | 1e6a41b5cfb405c8550969688a51aa702c5cec1a (diff) | |
download | bun-f839cf1ce309959f168066e51edc2e8b0038728e.tar.gz bun-f839cf1ce309959f168066e51edc2e8b0038728e.tar.zst bun-f839cf1ce309959f168066e51edc2e8b0038728e.zip |
Update crypto.mjs
Diffstat (limited to 'bench/snippets/crypto.mjs')
-rw-r--r-- | bench/snippets/crypto.mjs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/bench/snippets/crypto.mjs b/bench/snippets/crypto.mjs index e8e6f2f8a..484a4295d 100644 --- a/bench/snippets/crypto.mjs +++ b/bench/snippets/crypto.mjs @@ -1,12 +1,6 @@ // so it can run in environments without node module resolution import { bench, run } from "../node_modules/mitata/src/cli.mjs"; - -var crypto = globalThis.crypto; - -if (!crypto) { - crypto = await import("node:crypto"); -} - +import crypto from "node:crypto"; var foo = new Uint8Array(65536); bench("crypto.getRandomValues(65536)", () => { crypto.getRandomValues(foo); @@ -23,7 +17,7 @@ bench("crypto.randomUUID()", () => { }); bench("crypto.randomInt()", () => { - return crypto.randomInt(); + return crypto.randomInt(0, 100); }); await run(); |