-
-
Save dhet/66b1afc7602e2f77131ac35406dfea17 to your computer and use it in GitHub Desktop.
This file contains 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
function measureLag(iteration) { | |
const start = new Date() | |
setTimeout(() => { | |
const lag = new Date() - start | |
console.log(`Loop ${iteration} took\t${lag} ms`) | |
measureLag(iteration + 1) // Recurse | |
}) | |
} | |
measureLag(1) | |
const bcrypt = require("bcryptjs") | |
// const bcrypt= require("bcrypt") | |
function hash() { | |
const start = new Date() | |
const hashRounds = 10 // The more hash rounds the longer hashing takes | |
bcrypt.hash("hash me!", hashRounds, () => { | |
console.log(`--------- Hashing took ${new Date() - start} ms`) | |
setTimeout(hash) | |
}); | |
} | |
hash() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment