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

benchmark: update iterations in benhmark/crypto/hkdf.js #50866

Merged
merged 1 commit into from
Dec 3, 2023

Conversation

lucshi
Copy link

@lucshi lucshi commented Nov 23, 2023

Increase the iteration number from 1000 to 10000 to get a reasonble score. The updated score has up to ~60% improvement.

Refs: #50571

Below is the score improvment of each case.

crypto/hkdf.js hash="sha256" info="" salt="" key="a" size=10 sync=0:  n=10000 percent=130.37%
crypto/hkdf.js hash="sha512" info="" salt="" key="a" size=10 sync=0:  n=10000 percent=137.63%
crypto/hkdf.js hash="sha256" info="info" salt="" key="a" size=10 sync=0:  n=10000 percent=144.41%
crypto/hkdf.js hash="sha512" info="info" salt="" key="a" size=10 sync=0:  n=10000 percent=150.94%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="a" size=10 sync=0:  n=10000 percent=144.73%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="a" size=10 sync=0:  n=10000 percent=145.79%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="a" size=10 sync=0:  n=10000 percent=166.00%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="a" size=10 sync=0:  n=10000 percent=163.75%
crypto/hkdf.js hash="sha256" info="" salt="" key="secret" size=10 sync=0:  n=10000 percent=138.28%
crypto/hkdf.js hash="sha512" info="" salt="" key="secret" size=10 sync=0:  n=10000 percent=139.70%
crypto/hkdf.js hash="sha256" info="info" salt="" key="secret" size=10 sync=0:  n=10000 percent=145.13%
crypto/hkdf.js hash="sha512" info="info" salt="" key="secret" size=10 sync=0:  n=10000 percent=158.77%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="secret" size=10 sync=0:  n=10000 percent=150.70%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="secret" size=10 sync=0:  n=10000 percent=156.71%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="secret" size=10 sync=0:  n=10000 percent=151.73%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="secret" size=10 sync=0:  n=10000 percent=149.76%
crypto/hkdf.js hash="sha256" info="" salt="" key="this-is-a-much-longer-secret" size=10 sync=0:  n=10000 percent=145.89%
crypto/hkdf.js hash="sha512" info="" salt="" key="this-is-a-much-longer-secret" size=10 sync=0:  n=10000 percent=145.45%
crypto/hkdf.js hash="sha256" info="info" salt="" key="this-is-a-much-longer-secret" size=10 sync=0:  n=10000 percent=143.61%
crypto/hkdf.js hash="sha512" info="info" salt="" key="this-is-a-much-longer-secret" size=10 sync=0:  n=10000 percent=136.94%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="this-is-a-much-longer-secret" size=10 sync=0:  n=10000 percent=164.30%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="this-is-a-much-longer-secret" size=10 sync=0:  n=10000 percent=153.54%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="this-is-a-much-longer-secret" size=10 sync=0:  n=10000 percent=151.04%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="this-is-a-much-longer-secret" size=10 sync=0:  n=10000 percent=152.60%
crypto/hkdf.js hash="sha256" info="" salt="" key="a" size=64 sync=0:  n=10000 percent=149.21%
crypto/hkdf.js hash="sha512" info="" salt="" key="a" size=64 sync=0:  n=10000 percent=148.71%
crypto/hkdf.js hash="sha256" info="info" salt="" key="a" size=64 sync=0:  n=10000 percent=155.66%
crypto/hkdf.js hash="sha512" info="info" salt="" key="a" size=64 sync=0:  n=10000 percent=156.17%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="a" size=64 sync=0:  n=10000 percent=153.30%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="a" size=64 sync=0:  n=10000 percent=153.96%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="a" size=64 sync=0:  n=10000 percent=153.73%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="a" size=64 sync=0:  n=10000 percent=154.98%
crypto/hkdf.js hash="sha256" info="" salt="" key="secret" size=64 sync=0:  n=10000 percent=144.12%
crypto/hkdf.js hash="sha512" info="" salt="" key="secret" size=64 sync=0:  n=10000 percent=147.54%
crypto/hkdf.js hash="sha256" info="info" salt="" key="secret" size=64 sync=0:  n=10000 percent=153.23%
crypto/hkdf.js hash="sha512" info="info" salt="" key="secret" size=64 sync=0:  n=10000 percent=154.31%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="secret" size=64 sync=0:  n=10000 percent=155.34%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="secret" size=64 sync=0:  n=10000 percent=157.12%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="secret" size=64 sync=0:  n=10000 percent=150.21%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="secret" size=64 sync=0:  n=10000 percent=153.70%
crypto/hkdf.js hash="sha256" info="" salt="" key="this-is-a-much-longer-secret" size=64 sync=0:  n=10000 percent=144.18%
crypto/hkdf.js hash="sha512" info="" salt="" key="this-is-a-much-longer-secret" size=64 sync=0:  n=10000 percent=131.54%
crypto/hkdf.js hash="sha256" info="info" salt="" key="this-is-a-much-longer-secret" size=64 sync=0:  n=10000 percent=151.83%
crypto/hkdf.js hash="sha512" info="info" salt="" key="this-is-a-much-longer-secret" size=64 sync=0:  n=10000 percent=163.06%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="this-is-a-much-longer-secret" size=64 sync=0:  n=10000 percent=151.56%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="this-is-a-much-longer-secret" size=64 sync=0:  n=10000 percent=151.59%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="this-is-a-much-longer-secret" size=64 sync=0:  n=10000 percent=161.74%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="this-is-a-much-longer-secret" size=64 sync=0:  n=10000 percent=151.46%
crypto/hkdf.js hash="sha256" info="" salt="" key="a" size=1024 sync=0:  n=10000 percent=113.88%
crypto/hkdf.js hash="sha512" info="" salt="" key="a" size=1024 sync=0:  n=10000 percent=144.35%
crypto/hkdf.js hash="sha256" info="info" salt="" key="a" size=1024 sync=0:  n=10000 percent=117.53%
crypto/hkdf.js hash="sha512" info="info" salt="" key="a" size=1024 sync=0:  n=10000 percent=144.91%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="a" size=1024 sync=0:  n=10000 percent=123.14%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="a" size=1024 sync=0:  n=10000 percent=143.22%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="a" size=1024 sync=0:  n=10000 percent=114.85%
crypto/hkdf.js hash="sha256" info="" salt="" key="secret" size=1024 sync=0:  n=10000 percent=114.84%
crypto/hkdf.js hash="sha512" info="" salt="" key="secret" size=1024 sync=0:  n=10000 percent=141.60%
crypto/hkdf.js hash="sha256" info="info" salt="" key="secret" size=1024 sync=0:  n=10000 percent=114.24%
crypto/hkdf.js hash="sha512" info="info" salt="" key="secret" size=1024 sync=0:  n=10000 percent=142.87%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="secret" size=1024 sync=0:  n=10000 percent=119.90%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="secret" size=1024 sync=0:  n=10000 percent=122.07%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="secret" size=1024 sync=0:  n=10000 percent=110.31%
crypto/hkdf.js hash="sha256" info="" salt="" key="this-is-a-much-longer-secret" size=1024 sync=0:  n=10000 percent=110.05%
crypto/hkdf.js hash="sha512" info="" salt="" key="this-is-a-much-longer-secret" size=1024 sync=0:  n=10000 percent=110.27%
crypto/hkdf.js hash="sha256" info="info" salt="" key="this-is-a-much-longer-secret" size=1024 sync=0:  n=10000 percent=119.03%
crypto/hkdf.js hash="sha512" info="info" salt="" key="this-is-a-much-longer-secret" size=1024 sync=0:  n=10000 percent=110.96%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="this-is-a-much-longer-secret" size=1024 sync=0:  n=10000 percent=123.58%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="this-is-a-much-longer-secret" size=1024 sync=0:  n=10000 percent=110.73%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="this-is-a-much-longer-secret" size=1024 sync=0:  n=10000 percent=120.81%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="this-is-a-much-longer-secret" size=1024 sync=0:  n=10000 percent=111.63%
crypto/hkdf.js hash="sha256" info="" salt="" key="a" size=10 sync=1:  n=10000 percent=126.97%
crypto/hkdf.js hash="sha512" info="" salt="" key="a" size=10 sync=1:  n=10000 percent=124.29%
crypto/hkdf.js hash="sha256" info="info" salt="" key="a" size=10 sync=1:  n=10000 percent=127.90%
crypto/hkdf.js hash="sha512" info="info" salt="" key="a" size=10 sync=1:  n=10000 percent=125.24%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="a" size=10 sync=1:  n=10000 percent=129.15%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="a" size=10 sync=1:  n=10000 percent=126.17%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="a" size=10 sync=1:  n=10000 percent=130.78%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="a" size=10 sync=1:  n=10000 percent=128.28%
crypto/hkdf.js hash="sha256" info="" salt="" key="secret" size=10 sync=1:  n=10000 percent=126.82%
crypto/hkdf.js hash="sha512" info="" salt="" key="secret" size=10 sync=1:  n=10000 percent=125.08%
crypto/hkdf.js hash="sha256" info="info" salt="" key="secret" size=10 sync=1:  n=10000 percent=128.94%
crypto/hkdf.js hash="sha512" info="info" salt="" key="secret" size=10 sync=1:  n=10000 percent=122.23%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="secret" size=10 sync=1:  n=10000 percent=124.48%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="secret" size=10 sync=1:  n=10000 percent=118.93%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="secret" size=10 sync=1:  n=10000 percent=128.17%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="secret" size=10 sync=1:  n=10000 percent=124.77%
crypto/hkdf.js hash="sha256" info="" salt="" key="this-is-a-much-longer-secret" size=10 sync=1:  n=10000 percent=124.32%
crypto/hkdf.js hash="sha512" info="" salt="" key="this-is-a-much-longer-secret" size=10 sync=1:  n=10000 percent=119.69%
crypto/hkdf.js hash="sha256" info="info" salt="" key="this-is-a-much-longer-secret" size=10 sync=1:  n=10000 percent=124.92%
crypto/hkdf.js hash="sha512" info="info" salt="" key="this-is-a-much-longer-secret" size=10 sync=1:  n=10000 percent=122.55%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="this-is-a-much-longer-secret" size=10 sync=1:  n=10000 percent=125.24%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="this-is-a-much-longer-secret" size=10 sync=1:  n=10000 percent=125.28%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="this-is-a-much-longer-secret" size=10 sync=1:  n=10000 percent=126.60%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="this-is-a-much-longer-secret" size=10 sync=1:  n=10000 percent=123.68%
crypto/hkdf.js hash="sha256" info="" salt="" key="a" size=64 sync=1:  n=10000 percent=120.92%
crypto/hkdf.js hash="sha512" info="" salt="" key="a" size=64 sync=1:  n=10000 percent=120.53%
crypto/hkdf.js hash="sha256" info="info" salt="" key="a" size=64 sync=1:  n=10000 percent=124.23%
crypto/hkdf.js hash="sha512" info="info" salt="" key="a" size=64 sync=1:  n=10000 percent=121.80%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="a" size=64 sync=1:  n=10000 percent=124.00%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="a" size=64 sync=1:  n=10000 percent=121.95%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="a" size=64 sync=1:  n=10000 percent=126.62%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="a" size=64 sync=1:  n=10000 percent=124.46%
crypto/hkdf.js hash="sha256" info="" salt="" key="secret" size=64 sync=1:  n=10000 percent=122.81%
crypto/hkdf.js hash="sha512" info="" salt="" key="secret" size=64 sync=1:  n=10000 percent=120.64%
crypto/hkdf.js hash="sha256" info="info" salt="" key="secret" size=64 sync=1:  n=10000 percent=124.65%
crypto/hkdf.js hash="sha512" info="info" salt="" key="secret" size=64 sync=1:  n=10000 percent=123.39%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="secret" size=64 sync=1:  n=10000 percent=124.52%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="secret" size=64 sync=1:  n=10000 percent=123.52%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="secret" size=64 sync=1:  n=10000 percent=126.95%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="secret" size=64 sync=1:  n=10000 percent=124.54%
crypto/hkdf.js hash="sha256" info="" salt="" key="this-is-a-much-longer-secret" size=64 sync=1:  n=10000 percent=123.41%
crypto/hkdf.js hash="sha512" info="" salt="" key="this-is-a-much-longer-secret" size=64 sync=1:  n=10000 percent=121.07%
crypto/hkdf.js hash="sha256" info="info" salt="" key="this-is-a-much-longer-secret" size=64 sync=1:  n=10000 percent=123.85%
crypto/hkdf.js hash="sha512" info="info" salt="" key="this-is-a-much-longer-secret" size=64 sync=1:  n=10000 percent=122.17%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="this-is-a-much-longer-secret" size=64 sync=1:  n=10000 percent=124.74%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="this-is-a-much-longer-secret" size=64 sync=1:  n=10000 percent=122.33%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="this-is-a-much-longer-secret" size=64 sync=1:  n=10000 percent=126.81%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="this-is-a-much-longer-secret" size=64 sync=1:  n=10000 percent=123.97%
crypto/hkdf.js hash="sha256" info="" salt="" key="a" size=1024 sync=1:  n=10000 percent=116.01%
crypto/hkdf.js hash="sha512" info="" salt="" key="a" size=1024 sync=1:  n=10000 percent=114.03%
crypto/hkdf.js hash="sha256" info="info" salt="" key="a" size=1024 sync=1:  n=10000 percent=115.20%
crypto/hkdf.js hash="sha512" info="info" salt="" key="a" size=1024 sync=1:  n=10000 percent=114.27%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="a" size=1024 sync=1:  n=10000 percent=115.64%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="a" size=1024 sync=1:  n=10000 percent=113.07%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="a" size=1024 sync=1:  n=10000 percent=118.23%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="a" size=1024 sync=1:  n=10000 percent=114.00%
crypto/hkdf.js hash="sha256" info="" salt="" key="secret" size=1024 sync=1:  n=10000 percent=115.28%
crypto/hkdf.js hash="sha512" info="" salt="" key="secret" size=1024 sync=1:  n=10000 percent=112.68%
crypto/hkdf.js hash="sha256" info="info" salt="" key="secret" size=1024 sync=1:  n=10000 percent=114.88%
crypto/hkdf.js hash="sha512" info="info" salt="" key="secret" size=1024 sync=1:  n=10000 percent=113.57%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="secret" size=1024 sync=1:  n=10000 percent=115.94%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="secret" size=1024 sync=1:  n=10000 percent=116.70%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="secret" size=1024 sync=1:  n=10000 percent=114.79%
crypto/hkdf.js hash="sha256" info="" salt="" key="this-is-a-much-longer-secret" size=1024 sync=1:  n=10000 percent=115.64%
crypto/hkdf.js hash="sha512" info="" salt="" key="this-is-a-much-longer-secret" size=1024 sync=1:  n=10000 percent=113.45%
crypto/hkdf.js hash="sha256" info="info" salt="" key="this-is-a-much-longer-secret" size=1024 sync=1:  n=10000 percent=115.69%
crypto/hkdf.js hash="sha512" info="info" salt="" key="this-is-a-much-longer-secret" size=1024 sync=1:  n=10000 percent=113.01%
crypto/hkdf.js hash="sha256" info="" salt="salt" key="this-is-a-much-longer-secret" size=1024 sync=1:  n=10000 percent=116.74%
crypto/hkdf.js hash="sha512" info="" salt="salt" key="this-is-a-much-longer-secret" size=1024 sync=1:  n=10000 percent=115.86%
crypto/hkdf.js hash="sha256" info="info" salt="salt" key="this-is-a-much-longer-secret" size=1024 sync=1:  n=10000 percent=117.84%
crypto/hkdf.js hash="sha512" info="info" salt="salt" key="this-is-a-much-longer-secret" size=1024 sync=1:  n=10000 percent=114.26%```

@nodejs-github-bot nodejs-github-bot added benchmark Issues and PRs related to the benchmark subsystem. crypto Issues and PRs related to the crypto subsystem. labels Nov 23, 2023
@@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, {
salt: ['', 'salt'],
info: ['', 'info'],
hash: ['sha256', 'sha512'],
n: [1e3],
n: [1e4],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From 24s to 32s, is anyone against this change @nodejs/performance?

@lucshi lucshi changed the title benchmark: increase iteration number of crypto hkdf case benchmark: update iteration number of benhmark/crypto/hkdf.js Nov 27, 2023
@lucshi lucshi changed the title benchmark: update iteration number of benhmark/crypto/hkdf.js benchmark: update iterations in benhmark/crypto/hkdf.js Nov 27, 2023
@lucshi
Copy link
Author

lucshi commented Nov 27, 2023

Updated the commit message

@H4ad H4ad added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 2, 2023
@lpinca lpinca added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 3, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 3, 2023
@nodejs-github-bot nodejs-github-bot merged commit 23031d9 into nodejs:main Dec 3, 2023
23 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 23031d9

@lucshi lucshi deleted the my-branch-3 branch December 4, 2023 00:49
targos pushed a commit that referenced this pull request Dec 4, 2023
Fixes: #50571
PR-URL: #50866
Refs: #50571
Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
@targos targos mentioned this pull request Dec 4, 2023
richardlau pushed a commit that referenced this pull request Mar 25, 2024
Fixes: #50571
PR-URL: #50866
Refs: #50571
Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
@richardlau richardlau mentioned this pull request Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. benchmark Issues and PRs related to the benchmark subsystem. crypto Issues and PRs related to the crypto subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants