aboutsummaryrefslogtreecommitdiff
path: root/bench/snippets/crypto-stream.mjs
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-04-14 00:55:01 -0400
committerGravatar GitHub <noreply@github.com> 2023-04-13 21:55:01 -0700
commit3a2fd65f20d3b4e99c89f789acec5e5e40615008 (patch)
treed0491f57d2f612aaec638f52bdb36155e5b3bdde /bench/snippets/crypto-stream.mjs
parent267a38f6fc226156a50292945a697308e7201e69 (diff)
downloadbun-3a2fd65f20d3b4e99c89f789acec5e5e40615008.tar.gz
bun-3a2fd65f20d3b4e99c89f789acec5e5e40615008.tar.zst
bun-3a2fd65f20d3b4e99c89f789acec5e5e40615008.zip
use a lazyily initialized stream for `node:crypto` `createHash` (#2652)
* lazy hash * finish up crypto stuff * remove lockfiles * ok * add pipe test * update this lockfile * remove unrelated crypto benchmark from this file
Diffstat (limited to 'bench/snippets/crypto-stream.mjs')
-rw-r--r--bench/snippets/crypto-stream.mjs26
1 files changed, 26 insertions, 0 deletions
diff --git a/bench/snippets/crypto-stream.mjs b/bench/snippets/crypto-stream.mjs
new file mode 100644
index 000000000..3560563d9
--- /dev/null
+++ b/bench/snippets/crypto-stream.mjs
@@ -0,0 +1,26 @@
+// https://github.com/oven-sh/bun/issues/2190
+import { bench, run } from "mitata";
+import { createHash } from "node:crypto";
+
+const data =
+ "Delightful remarkably mr on announcing themselves entreaties favourable. About to in so terms voice at. Equal an would is found seems of. The particular friendship one sufficient terminated frequently themselves. It more shed went up is roof if loud case. Delay music in lived noise an. Beyond genius really enough passed is up.";
+
+const scenarios = [
+ { alg: "md5", digest: "hex" },
+ { alg: "md5", digest: "base64" },
+ { alg: "sha1", digest: "hex" },
+ { alg: "sha1", digest: "base64" },
+ { alg: "sha256", digest: "hex" },
+ { alg: "sha256", digest: "base64" },
+];
+
+for (const { alg, digest } of scenarios) {
+ bench(`${alg}-${digest}`, () => {
+ const hasher = createHash(alg);
+ hasher.write(data);
+ hasher.end();
+ hasher.read();
+ });
+}
+
+run();
td>Gravatar Jarred Sumner 2-2552/+2 2023-07-06Add missing export in `url`Gravatar Jarred Sumner 3-366/+3 2023-07-06Update trustedDeps docGravatar Colin McDonnell 2-2/+12 2023-07-06Update trustedDeps docGravatar Colin McDonnell 1-2/+12 2023-07-06refactor (#3543)Gravatar Ciro Spaciari 9-131/+53 2023-07-06fixes #3544 (#3549)Gravatar Dylan Conway 1-0/+1 2023-07-06Various docs updates (#3437)Gravatar Colin McDonnell 13-53/+355 * Various docs updates * Add mocks page * Fix make * WebKit instructions * Update instructions * Updates * Update nodejs compat table * Document trusted deps * Tweak trustedDependencies docs * Document --exact * Update test docs * Tweaks * Boring * Remove redundant j * Undo makefile changes * Undo makefile changes * Update page title * Regen * Undo changes 2023-07-06fix query without slash (#3547)Gravatar Ciro Spaciari 2-10/+14 2023-07-06Fixes #3537 (#3539)Gravatar Jarred Sumner 1-10/+41 Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-05don't unwrap react below version `18.0.0` (#3538)Gravatar Dylan Conway 2-5/+24 * don't unwrap react below version 18 * empty string * also `react-dom` 2023-07-05fix callbacks on release version (#3531)Gravatar Ciro Spaciari 2-31/+27 2023-07-05Update websocket_http_client.zigGravatar Dylan Conway 1-0/+2 2023-07-05Fixes #3512 (#3526)Gravatar Jarred Sumner 9-38/+168 * Fixes #3512 * Fix `clearTimeout` and `clearInterval` not cancelling jobs same-tick --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-05Fixes #3515 (#3523)Gravatar Jarred Sumner 4-190/+182 Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-05Fixes #3520 (#3522)Gravatar Jarred Sumner 3-23/+37 * Fixes #3520 * Update html_rewriter.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-05add envs on tests (#3518)Gravatar Ciro Spaciari 4-0/+20 Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> 2023-07-04Update build-idGravatar Jarred Sumner 1-1/+1 2023-07-04Fix build determinism issue (thanks to @alexlamsl)Gravatar Jarred Sumner 1-2/+2 cc @dylan-conway this was the cause 2023-07-04boopGravatar Jarred Sumner 10-55/+55 2023-07-04use sengrid account on nodemailer test (#3517)bun-v0.6.13Gravatar Ciro Spaciari 2-14/+15 2023-07-04[tls] fix servername (#3513)Gravatar Ciro Spaciari 4-8/+109 * fix servername * add postgres tls tests * update test packages * add basic CRUD test 2023-07-04Add alias for readBigUInt64BE ... (#3514)Gravatar Ai Hoshino 2-4/+58 * Add alias for `readBigUInt64BE` ... Close: https://github.com/oven-sh/bun/issues/3338 * add some tests for `readBigUint64BE` alias * format code 2023-07-04reduce countGravatar Jarred Sumner 1-2/+2 2023-07-04bumpGravatar Jarred Sumner 3-2/+2 2023-07-04Fix crashGravatar Jarred Sumner 1-5/+8