scryptsy icon indicating copy to clipboard operation
scryptsy copied to clipboard

Highly variable performance

Open dcousens opened this issue 7 years ago • 1 comments

let scrypt = require('scryptsy')
let passphrase = Buffer.from('54657374696e674f6e6554776f5468726565', 'hex')
let salt = Buffer.from('e957a24a', 'hex')

function time (f) {
  let t0 = new Date().getTime()
  f()
  console.log((new Date().getTime() - t0) + ' ms')
}

time(() => scrypt(passphrase, salt, 16384, 8, 8, 64))
time(() => scrypt(passphrase, salt, 16384, 8, 8, 64))
3058 ms
16034 ms

Results are consistently 5x on the second call. Related https://github.com/bitcoinjs/bip38/issues/40#issuecomment-361237029

dcousens avatar Jan 30 '18 01:01 dcousens

Any progress on this? I'm using BIP38 lib and these are the timings:

2461ms taken to decrypt
11303ms taken to decrypt.
11257ms taken to decrypt.

Appears to run fairly fast the first time, but all subsequent calls takes a lot of time.

sondreb avatar Feb 15 '19 00:02 sondreb