|
5 | 5 |
|
6 | 6 | 🚀 Fastest bcrypt in Node.js |
7 | 7 |
|
8 | | -## Support matrix |
9 | | - |
10 | | -| | node12 | node14 | node16 | node18 | |
11 | | -| ---------------- | ------ | ------ | ------ | ------ | |
12 | | -| Windows x64 | ✓ | ✓ | ✓ | ✓ | |
13 | | -| Windows x32 | ✓ | ✓ | ✓ | ✓ | |
14 | | -| Windows arm64 | ✓ | ✓ | ✓ | ✓ | |
15 | | -| macOS x64 | ✓ | ✓ | ✓ | ✓ | |
16 | | -| macOS arm64 | ✓ | ✓ | ✓ | ✓ | |
17 | | -| Linux x64 gnu | ✓ | ✓ | ✓ | ✓ | |
18 | | -| Linux x64 musl | ✓ | ✓ | ✓ | ✓ | |
19 | | -| Linux arm gnu | ✓ | ✓ | ✓ | ✓ | |
20 | | -| Linux arm64 gnu | ✓ | ✓ | ✓ | ✓ | |
21 | | -| Linux arm64 musl | ✓ | ✓ | ✓ | ✓ | |
22 | | -| Android arm64 | ✓ | ✓ | ✓ | ✓ | |
23 | | -| Android armv7 | ✓ | ✓ | ✓ | ✓ | |
24 | | -| FreeBSD x64 | ✓ | ✓ | ✓ | ✓ | |
25 | | - |
26 | 8 | ## Usage |
27 | 9 |
|
28 | 10 | ```typescript |
@@ -55,33 +37,54 @@ export function genSalt(round: number, version?: Version): Promise<string> |
55 | 37 | ## Bench |
56 | 38 |
|
57 | 39 | ``` |
58 | | -Model Name: MacBook Pro |
59 | | -Model Identifier: MacBookPro15,1 |
60 | | -Processor Name: Intel Core i7 |
61 | | -Processor Speed: 2.6 GHz |
62 | | -Number of Processors: 1 |
63 | | -Total Number of Cores: 6 |
64 | | -L2 Cache (per Core): 256 KB |
65 | | -L3 Cache: 12 MB |
66 | | -Hyper-Threading Technology: Enabled |
67 | | -Memory: 16 GB |
| 40 | + ,MMMM. Host - xxxxxxxxxxxxxxxxxxxxxxx |
| 41 | + .MMMMMM Machine - Mac15,9 |
| 42 | + MMMMM, Kernel - 24.0.0 |
| 43 | + .;MMMMM:' MMMMMMMMMM;. OS - macOS 15.0.1 Sequoia |
| 44 | + MMMMMMMMMMMMNWMMMMMMMMMMM: DE - Aqua |
| 45 | + .MMMMMMMMMMMMMMMMMMMMMMMMWM. WM - Quartz Compositor |
| 46 | + MMMMMMMMMMMMMMMMMMMMMMMMM. Packages - 194 (Homebrew), 32 (cargo) |
| 47 | + ;MMMMMMMMMMMMMMMMMMMMMMMM: Shell - zsh |
| 48 | + :MMMMMMMMMMMMMMMMMMMMMMMM: Terminal - warpterminal (Version v0.2024.10.23.14.49.stable_00) |
| 49 | + .MMMMMMMMMMMMMMMMMMMMMMMMM. Resolution - 5120x2880@160fps (as 2560x1440) |
| 50 | + MMMMMMMMMMMMMMMMMMMMMMMMMMM. 2992x1934@120fps (as 1496x967) |
| 51 | + .MMMMMMMMMMMMMMMMMMMMMMMMMM. 2232x1512@60fps (as 1116x756) |
| 52 | + MMMMMMMMMMMMMMMMMMMMMMMM Uptime - 1d 2h 32m |
| 53 | + ;MMMMMMMMMMMMMMMMMMMM. CPU - Apple M3 Max (16) |
| 54 | + .MMMM,. .MMMM,. CPU Load - 16% |
| 55 | + Memory - 50.1 GB / 134.2 GB |
| 56 | + Battery - 78% & Discharging |
| 57 | + Disk Space - 624.0 GB / 994.7 GB |
68 | 58 | ``` |
69 | 59 |
|
70 | 60 | ```text |
71 | | -@node-rs/bcrypt x 18.55 ops/sec ±1.51% (12 runs sampled) |
72 | | -node bcrypt x 16.37 ops/sec ±2.94% (11 runs sampled) |
73 | | -bcryptjs x 3.61 ops/sec ±4.86% (6 runs sampled) |
74 | | -Async hash round 12 bench suite: Fastest is @node-rs/bcrypt |
75 | | -@node-rs/bcrypt x 18.51 ops/sec ±1.60% (12 runs sampled) |
76 | | -node bcrypt x 16.51 ops/sec ±1.51% (11 runs sampled) |
77 | | -bcryptjs x 3.71 ops/sec ±2.23% (6 runs sampled) |
78 | | -Async verify bench suite: Fastest is @node-rs/bcrypt |
79 | | -@node-rs/bcrypt x 4.68 ops/sec ±4.69% (16 runs sampled) |
80 | | -node bcrypt x 3.94 ops/sec ±6.56% (14 runs sampled) |
81 | | -bcryptjs x 3.56 ops/sec ±2.04% (13 runs sampled) |
82 | | -Hash round 12 bench suite: Fastest is @node-rs/bcrypt |
83 | | -@node-rs/bcrypt x 521,917 ops/sec ±2.27% (82 runs sampled) |
84 | | -node bcrypt x 252,333 ops/sec ±2.05% (82 runs sampled) |
85 | | -bcryptjs x 110,578 ops/sec ±2.37% (82 runs sampled) |
86 | | -genSaltSync bench suite: Fastest is @node-rs/bcrypt |
| 61 | +❯ yarn workspace @node-rs/bcrypt bench |
| 62 | +Hash benchmark |
| 63 | +┌─────────┬───────────────────┬─────────┬───────────────────┬──────────┬─────────┐ |
| 64 | +│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │ |
| 65 | +├─────────┼───────────────────┼─────────┼───────────────────┼──────────┼─────────┤ |
| 66 | +│ 0 │ '@node-rs/bcrypt' │ '20' │ 49142200.63636367 │ '±1.08%' │ 11 │ |
| 67 | +│ 1 │ 'node bcrypt' │ '20' │ 49259219.81818187 │ '±1.35%' │ 11 │ |
| 68 | +│ 2 │ 'bcryptjs' │ '17' │ 58142116.79999998 │ '±0.36%' │ 10 │ |
| 69 | +│ 3 │ 'wasm OpenBSD' │ '17' │ 58318899.99999994 │ '±0.23%' │ 10 │ |
| 70 | +│ 4 │ 'wasm Openwall' │ '18' │ 53324629.20000016 │ '±0.37%' │ 10 │ |
| 71 | +└─────────┴───────────────────┴─────────┴───────────────────┴──────────┴─────────┘ |
| 72 | +Verify benchmark |
| 73 | +┌─────────┬───────────────────┬─────────┬────────────────────┬──────────┬─────────┐ |
| 74 | +│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │ |
| 75 | +├─────────┼───────────────────┼─────────┼────────────────────┼──────────┼─────────┤ |
| 76 | +│ 0 │ '@node-rs/bcrypt' │ '5' │ 192946879.09999993 │ '±0.52%' │ 10 │ |
| 77 | +│ 1 │ 'node bcrypt' │ '5' │ 199806404.2 │ '±0.36%' │ 10 │ |
| 78 | +│ 2 │ 'bcryptjs' │ '4' │ 231329516.79999986 │ '±0.13%' │ 10 │ |
| 79 | +└─────────┴───────────────────┴─────────┴────────────────────┴──────────┴─────────┘ |
| 80 | +GenSalt benchmark |
| 81 | +┌─────────┬───────────────────┬─────────────┬────────────────────┬──────────┬─────────┐ |
| 82 | +│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │ |
| 83 | +├─────────┼───────────────────┼─────────────┼────────────────────┼──────────┼─────────┤ |
| 84 | +│ 0 │ '@node-rs/bcrypt' │ '4,421,897' │ 226.14727567195578 │ '±0.08%' │ 2210949 │ |
| 85 | +│ 1 │ 'node bcrypt' │ '4,477,408' │ 223.34345972377827 │ '±0.08%' │ 2238705 │ |
| 86 | +│ 2 │ 'bcryptjs' │ '821,556' │ 1217.2015511950851 │ '±0.39%' │ 410779 │ |
| 87 | +│ 3 │ 'wasm OpenBSD' │ '3,685,603' │ 271.3259889021118 │ '±0.23%' │ 1842802 │ |
| 88 | +│ 4 │ 'wasm Openwall' │ '1,462,251' │ 683.8769076754866 │ '±2.50%' │ 731126 │ |
| 89 | +└─────────┴───────────────────┴─────────────┴────────────────────┴──────────┴─────────┘ |
87 | 90 | ``` |
0 commit comments