Created
August 11, 2022 10:04
-
-
Save wangbinyq/743b0f971cab6bb071cd7516af44cd01 to your computer and use it in GitHub Desktop.
deno bcrypt benchmark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as scrypt from "https://deno.land/x/[email protected]/mod.ts"; | |
| import * as bcrypt from "https://deno.land/x/[email protected]/mod.ts"; | |
| const testPassword = "This is a test password"; | |
| Deno.bench({ | |
| name: "scrypt", | |
| group: "hash", | |
| fn() { | |
| scrypt.hash(testPassword); | |
| }, | |
| }); | |
| Deno.bench({ | |
| name: "bcrypt async", | |
| group: "hash", | |
| async fn() { | |
| await bcrypt.hash(testPassword); | |
| }, | |
| }); | |
| Deno.bench({ | |
| name: "bcrypt sync", | |
| group: "hash", | |
| fn() { | |
| bcrypt.hashSync(testPassword); | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
benchmark time (avg) (min … max) p75 p99 p995
scrypt 90.76 ms/iter (87.17 ms … 95.56 ms) 92.08 ms 95.56 ms 95.56 ms
bcrypt async 115.11 ms/iter (110.8 ms … 118.47 ms) 116.9 ms 118.47 ms 118.47 ms
bcrypt sync 85.75 ms/iter (83.51 ms … 90.49 ms) 86.18 ms 90.49 ms 90.49 ms
summary
bcrypt sync
1.06x faster than scrypt
1.34x faster than bcrypt async