-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy paththreads.js
More file actions
24 lines (19 loc) · 764 Bytes
/
Copy paththreads.js
File metadata and controls
24 lines (19 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const crypto = require("crypto");
const start = Date.now();
crypto.pbkdf2("a", "b", 100000, 512, "sha512", () => {
console.log("1: ", Date.now() - start);
});
crypto.pbkdf2("a", "b", 100000, 512, "sha512", () => {
console.log("2: ", Date.now() - start);
});
crypto.pbkdf2("a", "b", 100000, 512, "sha512", () => {
console.log("3: ", Date.now() - start);
});
crypto.pbkdf2("a", "b", 100000, 512, "sha512", () => {
console.log("4: ", Date.now() - start);
});
crypto.pbkdf2("a", "b", 100000, 512, "sha512", () => {
console.log("5: ", Date.now() - start);
});
// Node is not always single threaded , some of the functions like pbkdf2 uses multiple threads extensively outside
//of the Eventn loop, backed by C++ multi thread pool which consists of 4 threads.