Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tls: improve createSecureContext in _tls_common #8781

Closed
wants to merge 1 commit into from

Conversation

yorkie
Copy link
Contributor

@yorkie yorkie commented Sep 26, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

tls

Description of change

The createSecureContext function is using let in for loop, to keep coding
consistence inside that function, update to use let/const, too.

@nodejs-github-bot nodejs-github-bot added the tls Issues and PRs related to the tls subsystem. label Sep 26, 2016
@mscdex
Copy link
Contributor

mscdex commented Sep 26, 2016

Actually, let should be changed to var instead (especially the loop variable), for performance reasons.

@yorkie
Copy link
Contributor Author

yorkie commented Sep 26, 2016

@mscdex Thanks for this tip, and I have followed your suggestion and replace all for-loops by array.forEach to avoid using the same iterator variable in the same scoping function createSecureContext.

@mscdex
Copy link
Contributor

mscdex commented Sep 26, 2016

The functional array methods are also slow unfortunately. What about just pulling the variable declaration out to the top of the function?

@yorkie yorkie force-pushed the tls/improve-createSecureContext branch from a33e722 to 796613e Compare September 26, 2016 05:52
@yorkie
Copy link
Contributor Author

yorkie commented Sep 26, 2016

Done @mscdex :)

@mscdex
Copy link
Contributor

mscdex commented Sep 26, 2016

LGTM if CI is ok with it: https://ci.nodejs.org/job/node-test-pull-request/4280/

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

LGTM

- this shares the iterator variable `i` expictly.
- this converts some var to const.

PR-URL: nodejs#8781
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@yorkie yorkie force-pushed the tls/improve-createSecureContext branch from 796613e to 86a6e57 Compare September 28, 2016 01:13
yorkie added a commit that referenced this pull request Sep 28, 2016
- this shares the iterator variable `i` expictly.
- this converts some var to const.

PR-URL: #8781
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@yorkie
Copy link
Contributor Author

yorkie commented Sep 28, 2016

CI is green and Landed in f4d7abf :)

@yorkie yorkie closed this Sep 28, 2016
@yorkie yorkie deleted the tls/improve-createSecureContext branch September 28, 2016 01:17
jasnell pushed a commit that referenced this pull request Sep 29, 2016
- this shares the iterator variable `i` expictly.
- this converts some var to const.

PR-URL: #8781
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Fishrock123 pushed a commit that referenced this pull request Oct 11, 2016
- this shares the iterator variable `i` expictly.
- this converts some var to const.

PR-URL: #8781
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tls Issues and PRs related to the tls subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants