Uh oh!
There was an error while loading. Please reload this page.
tls: avoid calling Buffer.byteLength multiple times - #7236
Conversation
indutny
commented
Jun 8, 2016
Is it optimization for the client? |
jasnell
commented
Jun 8, 2016
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. |
There was a problem hiding this comment.
Should this be n Array of size protocols.length?
There was a problem hiding this comment.
so new Array(protocols.length) should boost the micro-benchmark? 😉
There was a problem hiding this comment.
the difference is not even noticeable really. :-)
jasnell
commented
Jun 8, 2016
updated! |
indutny
commented
Jun 9, 2016
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
e9aaabbComparejasnell
commented
Jun 21, 2016
jasnell
commented
Jun 21, 2016
Failures are unrelated. Also, it looks like we're having some CI troubles with a few bots hanging (@nodejs/build) |
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>
jasnell
commented
Jun 21, 2016
Landed in f3d5efa |
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>
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>
MylesBorins
commented
Jul 11, 2016
@jasnell lts? |
MylesBorins
commented
Oct 10, 2016
This does not land cleanly in LTS. Added dont-land label. Please feel free to manually backport @jasnell |
jasnell
commented
Oct 10, 2016
This should be fine not to backport. |
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