nodejs / nodejs/performance

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

Open
#84 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
399
Forks
11
Avg merge
29m
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided crypto.pbkdf2Sync benchmark and compare Node.js 14/16 with 18/20 on the reported Windows and Linux platforms. Reproduce the regression, then trace crypto subsystem changes between those versions; done means identifying the cause and showing benchmark results without the comparable slowdown.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.