If you are logging in User, even if you are using the native version of bcrypt you may have noticed a significant decrease in performance.
After digging around in the bcrypt repository, I found the following:
User.hashPassword = function(plain) { |
| this.validatePassword(plain); |
| var salt = bcrypt.genSaltSync(this.settings.saltWorkFactor || SALT_WORK_FACTOR); |
| return bcrypt.hashSync(plain, salt); |
| }; |
Which led me to the idea of just setting the saltWorkFactor on the User object as such:
After setting the value to 4 (default is 10), my tests ran over 8 times faster!