Uh oh!
There was an error while loading. Please reload this page.
lib: refactor tls options handle in https.js - #27118
Closed
gengjiawen wants to merge 1 commit into
Closed
Conversation
gengjiawenforce-pushed
the
rafactor_header_handle
branch
from
April 7, 2019 09:26
52841ee to
0057d90Comparelpinca
commented
Apr 7, 2019
Member
@gengjiawen a for loop was not used for performance reasons. See discussion in #16402. |
MemberAuthor
Looks like 2x diff (Node node: '12.0.0-pre', v8: '7.3.492.25-node.7') es\arrary-vs-invidual.js mode="Array" n=1000: 263,026.3123632099es\arrary-vs-invidual.js mode="Invidual" n=1000: 469,417.45294090034Details'use strict';constcommon=require('../common.js');constconfigs={n: [1e3],mode: ['Array','Invidual']};constbench=common.createBenchmark(main,configs);functionmain({ n, mode }){switch(mode){case'':
// Empty string falls through to next line as default, mostly for tests.case'Array':
bench.start();for(leti=0;i<n;i++)useArray();bench.end(n);break;case'Invidual':
bench.start();for(leti=0;i<n;i++)useInvidual();bench.end(n);break;default:
thrownewError(`Unexpected method "${mode}"`);}}functionuseArray(){letname='';letoptions={};constoptions_keys=['ca','cert','ciphers','clientCertEngine','crl','dhparam','ecdhCurve','honorCipherOrder','key','maxVersion','minVersion','pfx','rejectUnauthorized','secureOptions','secureProtocol','sessionIdContext'];options_keys.forEach((i)=>{name+=':';if(options[i]){name+=options[i];}});name+=':';if(options.servername&&options.servername!==options.host)name+=options.servername;returnname;}functionuseInvidual(){letname='';letoptions={};name+=':';if(options.ca)name+=options.ca;name+=':';if(options.cert)name+=options.cert;name+=':';if(options.clientCertEngine)name+=options.clientCertEngine;name+=':';if(options.ciphers)name+=options.ciphers;name+=':';if(options.key)name+=options.key;name+=':';if(options.pfx)name+=options.pfx;name+=':';if(options.rejectUnauthorized!==undefined)name+=options.rejectUnauthorized;name+=':';if(options.servername&&options.servername!==options.host)name+=options.servername;name+=':';if(options.minVersion)name+=options.minVersion;name+=':';if(options.maxVersion)name+=options.maxVersion;name+=':';if(options.secureProtocol)name+=options.secureProtocol;name+=':';if(options.crl)name+=options.crl;name+=':';if(options.honorCipherOrder!==undefined)name+=options.honorCipherOrder;name+=':';if(options.ecdhCurve)name+=options.ecdhCurve;name+=':';if(options.dhparam)name+=options.dhparam;name+=':';if(options.secureOptions!==undefined)name+=options.secureOptions;name+=':';if(options.sessionIdContext)name+=options.sessionIdContext;returnname;} |
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 freeto 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(Windows) passes