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

crypto.pbkdf2Sync - ~40% performance drop from node 14/16 to 18/20 #84

Open
NewEraCracker opened this issue May 20, 2023 · 2 comments
Open

Comments

@NewEraCracker
Copy link

NewEraCracker commented May 20, 2023

Version

v18.16.0

Platform

Microsoft Windows NT 10.0.19045.0 x64

Subsystem

crypto

What steps will reproduce the bug?

const crypto = require('crypto');
const ts = Date.now();
crypto.pbkdf2Sync('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXXXXXXX', 100000, 32, 'sha512');
console.log(Date.now() - ts);

How often does it reproduce? Is there a required condition?

The code snippet in varying platforms logs lower numbers when ran on Node.js 14 & 16 (better) comparatively to Node.js 18 & 20 (worse).

Examples:

Windows 10

node 14/16: 70
node 18/20: 99

Ubuntu 20

node 14/16: 177
node 18/20: 240

And I've encountered similar results on Ubuntu 22, Debian 11, etc...

What is the expected behavior? Why is that the expected behavior?

I would expect no performance regression.

What do you see instead?

Performance regression ranging from ~30% to ~40%

Additional information

No response

@aduh95 aduh95 transferred this issue from nodejs/node May 20, 2023
@H4ad
Copy link
Member

H4ad commented May 20, 2023

Probably related to #72

@NewEraCracker
Copy link
Author

Built Node.js 18 from source with OpenSSL 1.1.1t on the Ubuntu 20 system - the build took some hours.

$ node poc.js
162
$ node poc.js
160

At least there is a workaround now. Thanks for the info!

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

No branches or pull requests

2 participants