GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — crypto: use new.target instead of instaceof to detect construct calls by joyeecheung · Pull Request #51026 · nodejs/node

Conversation

@joyeecheung

@joyeecheung joyeecheung commented Dec 3, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

The former is much more performant.

Refs: nodejs/performance#136

On macOS + M2:

                                                                                confidence improvement accuracy (*)   (**)  (***)
crypto/webcrypto-digest.js n=100000 method='SHA-1' data=10 sync='createHash'           ***      4.19 %       ±1.05% ±1.40% ±1.84%
crypto/webcrypto-digest.js n=100000 method='SHA-1' data=100 sync='createHash'          ***      4.83 %       ±0.64% ±0.85% ±1.10%
crypto/webcrypto-digest.js n=100000 method='SHA-1' data=20 sync='createHash'            **      3.77 %       ±2.59% ±3.49% ±4.62%
crypto/webcrypto-digest.js n=100000 method='SHA-1' data=50 sync='createHash'           ***      5.10 %       ±0.56% ±0.75% ±0.98%
crypto/webcrypto-digest.js n=100000 method='SHA-256' data=10 sync='createHash'         ***      5.82 %       ±2.27% ±3.05% ±4.04%
crypto/webcrypto-digest.js n=100000 method='SHA-256' data=100 sync='createHash'        ***      5.86 %       ±2.46% ±3.31% ±4.37%
crypto/webcrypto-digest.js n=100000 method='SHA-256' data=20 sync='createHash'         ***      5.92 %       ±2.24% ±3.02% ±4.00%
crypto/webcrypto-digest.js n=100000 method='SHA-256' data=50 sync='createHash'         ***      5.67 %       ±0.50% ±0.66% ±0.87%
crypto/webcrypto-digest.js n=100000 method='SHA-384' data=10 sync='createHash'         ***      4.68 %       ±0.72% ±0.96% ±1.25%
crypto/webcrypto-digest.js n=100000 method='SHA-384' data=100 sync='createHash'        ***      5.83 %       ±2.52% ±3.39% ±4.49%
crypto/webcrypto-digest.js n=100000 method='SHA-384' data=20 sync='createHash'           *      2.91 %       ±2.73% ±3.68% ±4.88%
crypto/webcrypto-digest.js n=100000 method='SHA-384' data=50 sync='createHash'         ***      4.19 %       ±0.79% ±1.06% ±1.39%
crypto/webcrypto-digest.js n=100000 method='SHA-512' data=10 sync='createHash'          **      3.51 %       ±2.28% ±3.07% ±4.06%
crypto/webcrypto-digest.js n=100000 method='SHA-512' data=100 sync='createHash'        ***      5.01 %       ±0.54% ±0.71% ±0.93%
crypto/webcrypto-digest.js n=100000 method='SHA-512' data=20 sync='createHash'          **      4.38 %       ±2.64% ±3.53% ±4.64%
crypto/webcrypto-digest.js n=100000 method='SHA-512' data=50 sync='createHash'          **      4.01 %       ±2.40% ±3.22% ±4.26%
crypto/create-hash.js n=100000        ***      6.77 %       ±3.00% ±3.99% ±5.20%

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss and CanadaHonk reacted with rocket emoji
All reactions
  • 🚀 2 reactions
joyeecheung added 2 commits December 3, 2023 02:56
@joyeecheung
benchmark: add create-hash benchmark
ca73165
@joyeecheung
crypto: use new.target instead of instaceof to detect construct calls
c7decde
The former is much more performant.
@nodejs-github-bot

nodejs-github-bot commented Dec 3, 2023

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added crypto Issues and PRs related to the crypto subsystem. needs-ci PRs that need a full CI run. labels Dec 3, 2023
@joyeecheung joyeecheung mentioned this pull request Dec 3, 2023
Optimizing hashing performance nodejs/performance#136
Closed
@joyeecheung

joyeecheung commented Dec 3, 2023

Copy link
Copy Markdown
Member Author

Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1477/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Jarred-Sumner Jarred-Sumner mentioned this pull request Dec 3, 2023
Use new.target instead of instanceof to detect if its a constructor call oven-sh/bun#7431
Closed
@targos

targos commented Dec 3, 2023

Copy link
Copy Markdown
Member

There's a typo in the commit message (instaceof)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mcollina
mcollina approved these changes Dec 3, 2023
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
targos
targos approved these changes Dec 3, 2023
View reviewed changes
H4ad
H4ad approved these changes Dec 3, 2023
View reviewed changes
Comment thread benchmark/crypto/create-hash.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

tniessen
tniessen approved these changes Dec 3, 2023
View reviewed changes
@tniessen

tniessen commented Dec 3, 2023

Copy link
Copy Markdown
Member

As usual, amazing work @joyeecheung :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung @H4ad
fixup! crypto: use new.target instead of instaceof to detect construc…
b9873dd
…t calls

Co-authored-by: Vinicius Lourenço <[email protected]>
@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Dec 3, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Dec 3, 2023
@nodejs-github-bot

nodejs-github-bot commented Dec 3, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/56053/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lpinca
lpinca approved these changes Dec 3, 2023
View reviewed changes
@nodejs-github-bot

nodejs-github-bot commented Dec 3, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/56061/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung joyeecheung added commit-queue PRs queued for automated landing through the Commit Queue. commit-queue-squash PRs the Commit Queue should land as one squashed commit. labels Dec 5, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Dec 5, 2023
@nodejs-github-bot
nodejs-github-bot merged commit c97322a into nodejs:main Dec 5, 2023
@nodejs-github-bot

nodejs-github-bot commented Dec 5, 2023

Copy link
Copy Markdown
Collaborator

Landed in c97322a

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

RafaelGSS pushed a commit that referenced this pull request Dec 15, 2023
@joyeecheung @RafaelGSS
benchmark: add create-hash benchmark
b148c43
PR-URL: #51026
Refs: nodejs/performance#136
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Dec 15, 2023
v21.5.0 proposal #51166
Merged
richardlau pushed a commit that referenced this pull request Mar 25, 2024
@joyeecheung @richardlau
benchmark: add create-hash benchmark
3ab6143
PR-URL: #51026
Refs: nodejs/performance#136
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@richardlau richardlau mentioned this pull request Mar 25, 2024
v20.12.0 proposal #52212
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes
@lpinca lpinca lpinca approved these changes
@tniessen tniessen tniessen approved these changes
@H4ad H4ad H4ad approved these changes
+1 more reviewer
@targos targos targos approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

commit-queue-squash PRs the Commit Queue should land as one squashed commit. crypto Issues and PRs related to the crypto subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@joyeecheung @nodejs-github-bot @targos @tniessen @mcollina @lpinca @H4ad
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.