Skip to content

crypto,tls: perf improvements for crypto and tls getCiphers - #7225

Closed
jasnell wants to merge 1 commit into
nodejs:masterfrom
jasnell:perf-get-ciphers
Closed

crypto,tls: perf improvements for crypto and tls getCiphers#7225
jasnell wants to merge 1 commit into
nodejs:masterfrom
jasnell:perf-get-ciphers

Conversation

@jasnell

Copy link
Copy Markdown
Member
Checklist
  • make -j4 test (UNIX) or vcbuild test nosign (Windows) passes
  • a test and/or benchmark is included
  • the commit message follows commit guidelines
Affected core subsystem(s)

crypto, tls

Description of change

Improve performance of crypto.getCiphers, getHashes, getCurves
and tls.getCiphers by consolidating filterDuplicates logic, adding
caching of output, and streamlining filterDuplicates implementation.

Benchmarks:

crypto.getCiphers n=1 v6.2.1 = 2559.3, new = 15890 ...... -83.89%
crypto.getCiphers n=5000 v6.2.1 = 3516.3, new = 24203000 ... -99.99%

tls.getCiphers n=1 v6.2.1 = 3405.3, new = 14877 ...... -77.11%
tls.getCiphers n=5000 v6.2.1 = 6074.4, new = 24202000 ... -99.97%

@nodejs/crypto @mscdex

@jasnelljasnell added tls Issues and PRs related to the tls subsystem. crypto Issues and PRs related to the crypto subsystem. labels Jun 8, 2016
@nodejs-github-botnodejs-github-bot added the util Issues and PRs related to the built-in util module. label Jun 8, 2016
@jasnell

Copy link
Copy Markdown
MemberAuthor

@bnoordhuis

Copy link
Copy Markdown
Member

Is this really worth optimizing?

@jasnell

Copy link
Copy Markdown
MemberAuthor

It's not a high priority by any means but a perf boost is a perf boost ;-)

Comment threadlib/tls.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any point in prefixing module-local variable?

@jasnell

Copy link
Copy Markdown
MemberAuthor

@indutny ... updated!

@indutny

Copy link
Copy Markdown
Member

LGTM, if CI is green.

@indutny

Copy link
Copy Markdown
Member

Thank you.

@mscdexmscdex added the performance Issues and PRs related to the performance of Node.js. label Jun 8, 2016
Comment threadlib/tls.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor nit: true would look better than 1 for a boolean argument

@mscdex

mscdex commented Jun 11, 2016

Copy link
Copy Markdown
Contributor

LGTM except for one minor nit and if CI is ok with it: https://ci.nodejs.org/job/node-test-pull-request/2986/

Improve performance of crypto.getCiphers, getHashes, getCurves
and tls.getCiphers by consolidating filterDuplicates logic, adding
caching of output, and streamlining filterDuplicates implementation.
Benchmarks:
crypto.getCiphers n=1 v6.2.1 = 2559.3, new = 15890 ...... -83.89%
crypto.getCiphers n=5000 v6.2.1 = 3516.3, new = 24203000 ... -99.99%
tls.getCiphers n=1 v6.2.1 = 3405.3, new = 14877 ...... -77.11%
tls.getCiphers n=5000 v6.2.1 = 6074.4, new = 24202000 ... -99.97%
@jasnell

Copy link
Copy Markdown
MemberAuthor

Nit addressed, commits squashed, new CI: https://ci.nodejs.org/job/node-test-pull-request/3039/

jasnell added a commit that referenced this pull request Jun 21, 2016
Improve performance of crypto.getCiphers, getHashes, getCurves
and tls.getCiphers by consolidating filterDuplicates logic, adding
caching of output, and streamlining filterDuplicates implementation.
Benchmarks:
crypto.getCiphers n=1 v6.2.1 = 2559.3, new = 15890 ...... -83.89%
crypto.getCiphers n=5000 v6.2.1 = 3516.3, new = 24203000 ... -99.99%
tls.getCiphers n=1 v6.2.1 = 3405.3, new = 14877 ...... -77.11%
tls.getCiphers n=5000 v6.2.1 = 6074.4, new = 24202000 ... -99.97%
PR-URL: #7225
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
@jasnell

Copy link
Copy Markdown
MemberAuthor

Landed in 6be73fe

@jasnelljasnell closed this Jun 21, 2016
Fishrock123 pushed a commit that referenced this pull request Jun 27, 2016
Improve performance of crypto.getCiphers, getHashes, getCurves
and tls.getCiphers by consolidating filterDuplicates logic, adding
caching of output, and streamlining filterDuplicates implementation.
Benchmarks:
crypto.getCiphers n=1 v6.2.1 = 2559.3, new = 15890 ...... -83.89%
crypto.getCiphers n=5000 v6.2.1 = 3516.3, new = 24203000 ... -99.99%
tls.getCiphers n=1 v6.2.1 = 3405.3, new = 14877 ...... -77.11%
tls.getCiphers n=5000 v6.2.1 = 6074.4, new = 24202000 ... -99.97%
PR-URL: #7225
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
@Fishrock123Fishrock123 mentioned this pull request Jun 27, 2016
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
Improve performance of crypto.getCiphers, getHashes, getCurves
and tls.getCiphers by consolidating filterDuplicates logic, adding
caching of output, and streamlining filterDuplicates implementation.
Benchmarks:
crypto.getCiphers n=1 v6.2.1 = 2559.3, new = 15890 ...... -83.89%
crypto.getCiphers n=5000 v6.2.1 = 3516.3, new = 24203000 ... -99.99%
tls.getCiphers n=1 v6.2.1 = 3405.3, new = 14877 ...... -77.11%
tls.getCiphers n=5000 v6.2.1 = 6074.4, new = 24202000 ... -99.97%
PR-URL: #7225
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Conflicts:
lib/internal/util.js
@Fishrock123Fishrock123 mentioned this pull request Jul 5, 2016
@MylesBorins

Copy link
Copy Markdown
Contributor

@jasnell lts?

@MylesBorins

Copy link
Copy Markdown
Contributor

this is not landing cleanly so I am going to mark as don't land. Please feel free to backport

@MylesBorins

Copy link
Copy Markdown
Contributor

/cc @jasnell

@jasnell

Copy link
Copy Markdown
MemberAuthor

Not backporting this should be fine.

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

Labels

cryptoIssues and PRs related to the crypto subsystem.performanceIssues and PRs related to the performance of Node.js.tlsIssues and PRs related to the tls subsystem.utilIssues and PRs related to the built-in util module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@jasnell@bnoordhuis@indutny@mscdex@MylesBorins@nodejs-github-bot