tls: avoid calling Buffer.byteLength multiple times#7236
Closed
jasnell wants to merge 1 commit intonodejs:masterfrom
Closed
tls: avoid calling Buffer.byteLength multiple times#7236jasnell wants to merge 1 commit intonodejs:masterfrom
jasnell wants to merge 1 commit intonodejs:masterfrom
Conversation
Member
|
Is it optimization for the client? |
Member
Author
|
client and server, only with ALPN or NPN are passed in as an Array. Very minor and low priority but just happened to spot it. |
lib/tls.js
Outdated
Member
There was a problem hiding this comment.
Should this be n Array of size protocols.length?
Member
There was a problem hiding this comment.
so new Array(protocols.length) should boost the micro-benchmark? 😉
Member
Author
There was a problem hiding this comment.
the difference is not even noticeable really. :-)
Member
Author
|
updated! |
Member
|
LGTM |
There's no reason to be calling Buffer.byteLength() twice. Small perf improvement Run 1: tls/convertprotocols.js n=1 v6.2.1 = 11852, new = 12204 ...... -2.89% tls/convertprotocols.js n=50000 v6.2.1 = 515660, new = 570610 ..... -9.63% Run 2: tls/convertprotocols.js n=1 v6.2.1 = 11729, new = 12045 ...... -2.62% tls/convertprotocols.js n=50000 v6.2.1 = 512080, new = 637730 ..... -19.70%
c441764 to
e9aaabb
Compare
Member
Author
Member
Author
|
Failures are unrelated. Also, it looks like we're having some CI troubles with a few bots hanging (@nodejs/build) |
jasnell
added a commit
that referenced
this pull request
Jun 21, 2016
There's no reason to be calling Buffer.byteLength() twice. Small perf improvement Run 1: tls/convertprotocols.js n=1 v6.2.1 = 11852, new = 12204 ...... -2.89% tls/convertprotocols.js n=50000 v6.2.1 = 515660, new = 570610 ..... -9.63% Run 2: tls/convertprotocols.js n=1 v6.2.1 = 11729, new = 12045 ...... -2.62% tls/convertprotocols.js n=50000 v6.2.1 = 512080, new = 637730 ..... -19.70% PR-URL: #7236 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Member
Author
|
Landed in f3d5efa |
Fishrock123
pushed a commit
that referenced
this pull request
Jun 27, 2016
There's no reason to be calling Buffer.byteLength() twice. Small perf improvement Run 1: tls/convertprotocols.js n=1 v6.2.1 = 11852, new = 12204 ...... -2.89% tls/convertprotocols.js n=50000 v6.2.1 = 515660, new = 570610 ..... -9.63% Run 2: tls/convertprotocols.js n=1 v6.2.1 = 11729, new = 12045 ...... -2.62% tls/convertprotocols.js n=50000 v6.2.1 = 512080, new = 637730 ..... -19.70% PR-URL: #7236 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Merged
Fishrock123
pushed a commit
that referenced
this pull request
Jul 5, 2016
There's no reason to be calling Buffer.byteLength() twice. Small perf improvement Run 1: tls/convertprotocols.js n=1 v6.2.1 = 11852, new = 12204 ...... -2.89% tls/convertprotocols.js n=50000 v6.2.1 = 515660, new = 570610 ..... -9.63% Run 2: tls/convertprotocols.js n=1 v6.2.1 = 11729, new = 12045 ...... -2.62% tls/convertprotocols.js n=50000 v6.2.1 = 512080, new = 637730 ..... -19.70% PR-URL: #7236 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Merged
Contributor
|
@jasnell lts? |
Contributor
|
This does not land cleanly in LTS. Added dont-land label. Please feel free to manually backport @jasnell |
Member
Author
|
This should be fine not to backport. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Checklist
make -j4 test(UNIX) orvcbuild test nosign(Windows) passesAffected core subsystem(s)
tls
Description of change
There's no reason to be calling Buffer.byteLength() twice. That's just silly.
Small perf improvement
Run 1:
tls/convertprotocols.js n=1 v6.2.1 = 11852, new = 12204 ...... -2.89%
tls/convertprotocols.js n=50000 v6.2.1 = 515660, new = 570610 ..... -9.63%
Run 2:
tls/convertprotocols.js n=1 v6.2.1 = 11729, new = 12045 ...... -2.62%
tls/convertprotocols.js n=50000 v6.2.1 = 512080, new = 637730 ..... -19.70%
@nodejs/crypto