Skip to content

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

Description

@NewEraCracker

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

Activity

  1. transferred this issue fromnodejs/nodeon May 20, 2023
  2. H4ad commented on May 20, 2023

    @H4ad
    Member

    Probably related to #72

  3. NewEraCracker commented on May 23, 2023

    @NewEraCracker
    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!

  4. RafaelGSS commented on Aug 15, 2025

    @RafaelGSS
    Member

    Can you compare with Node.js 24 now?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions