Skip to content
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

Poor performance when decrypting 2+ keys #40

Closed
Rufus-L opened this issue Jan 27, 2018 · 4 comments
Closed

Poor performance when decrypting 2+ keys #40

Rufus-L opened this issue Jan 27, 2018 · 4 comments

Comments

@Rufus-L
Copy link

Rufus-L commented Jan 27, 2018

Hey,
I'd like to know why it takes about 2-3s to decrypt one key, but then it gets a lot worse for subsequent keys (12-15s). Is it possible to improve that?

That happens either running with Node or Web browser.

var bip38 = require("bip38");
var keyList = ["6PnQYMjJ7ZXpX8rbh8b6PfzK38WG5KL9mGqscB2RXFGb4ZKwXBaP5gMmhC", "6PnPNwvsTy3jeogyENrV23F15om4ecbEmFZcYrjrTsPgvKEwfnubVEAEEc"];
var password = "123";

for (var key of keyList) {
  var t0 = new Date().getTime();
  bip38.decrypt(key, password);
  console.log((new Date().getTime() - t0) + " ms");
}
@dcousens
Copy link
Contributor

A sample of 2 keys is probably not a great example, but, I'd be happy to look into this. It is likely this is a hot-spotting issue from the VM mis-optimizing the code.

Are you experiencing this consistently?

@Rufus-L
Copy link
Author

Rufus-L commented Jan 29, 2018

I used a sample of 2 to make the code simpler. The result is always the same: first one is quick, all the others take about 5x the time.

That happens everytime. Even if the 1st and 2nd keys are the same.

@dcousens
Copy link
Contributor

dcousens commented Jan 30, 2018

Reproduced. 5x.
Will investigate...

@dcousens
Copy link
Contributor

Closing in favour of cryptocoinjs/scryptsy#8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants