scrypt-pbkdf icon indicating copy to clipboard operation
scrypt-pbkdf copied to clipboard

Library is actually slower than `scrypt-js` with `setImmediate` polyfill

Open desfero opened this issue 2 years ago • 0 comments

It appears the library is actually around 25% slower than scrypt-js when the polifill for setImmediate is provided (otherwise it fallbacks to setTimeout which is slower due to being run in the tasks queue not micro tasks queue).

Input: {"P":"pleaseletmein","S":"SodiumChloride","N":65536,"r":8,"p":1,"dkLen":64}
  scrypt-pbkdf — mean time: 626ms ±1.84% (9 runs sampled)
  scrypt-js — mean time: 485ms ±3.34% (9 runs sampled)
  scryptsy — mean time: 23649ms ±267.28% (8 runs sampled)

Input: {"P":"pleaseletmein","S":"SodiumChloride","N":131072,"r":8,"p":1,"dkLen":64}
  scrypt-pbkdf — mean time: 1292ms ±4.10% (7 runs sampled)
  scrypt-js — mean time: 946ms ±2.58% (9 runs sampled)
  scryptsy — mean time: 10943ms ±186.85% (6 runs sampled)

Input: {"P":"pleaseletmein","S":"SodiumChloride","N":262144,"r":8,"p":1,"dkLen":64}
  scrypt-pbkdf — mean time: 2529ms ±1.60% (6 runs sampled)
  scrypt-js — mean time: 1888ms ±1.64% (7 runs sampled)
  scryptsy — mean time: 5179ms ±0.14% (5 runs sampled)

desfero avatar Nov 06 '23 16:11 desfero