-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance becomes very bad after tens of calls of scrypt() #32
Comments
Does it happen every time you try? Can't reproduce it on 10.12.4 (16E195), 2.6 GHz Intel Core i5, 8 GB 1600 MHz DDR3, even after 500 attempts. My guess would be that it's either the garbage collector kicks in and slows things down, or your CPU is getting throttled (most likely the latter). |
Yes, I can reproduce it every time I try, I can reproduce it in a Linode VPS which has 1GB memory as well. I tried to test with different node versions today, and this seems related to node, the performance issue happened with node version 4.4.5, if I run the test code with node 6.10.1, no performance issue. |
Hi, The same problem exists in the eth-lightwallet library. I have implemented a solution for reducing the nextTick calls to bypass the browser throttling in this area. Look at this pull request. |
This also happens on JavaScriptCore (React Native). It doesn't seem to be a library problem, but an engine problem, unfortunately. |
"interruptStep: 0" in the OP's code implies no calls to nextTick (just synchronous looping) so I don't understand why it would slow down after repeated calls (i.e. no nextTick throttling) |
I encountered performance issue when using scrypt-async to crypt the password, following is the test code
After tens of calling of scrypt, the encryption time becomes 15 times more, following is the output:
As you can see, the beginning 43 calls just cost about 150ms in average, but from the 44th call, the time increased to 2300ms.
The scrypt-async version is 1.3.1, nodejs version 4.4.5
I'm using a MacOS, version 10.12.4 (16E195), Processor 2.8 GHz Intel Core i7, Memory 16 GB 1600 MHz DDR3.
The text was updated successfully, but these errors were encountered: