aboutsummaryrefslogtreecommitdiff
path: root/bench/snippets/crypto.mjs
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-06-26 19:07:00 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-06-26 19:07:54 -0700
commitf839cf1ce309959f168066e51edc2e8b0038728e (patch)
tree19f9da6079ce47e97ee442ae43a0fe9dd94189dd /bench/snippets/crypto.mjs
parent1e6a41b5cfb405c8550969688a51aa702c5cec1a (diff)
downloadbun-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.mjs10
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();