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

tty: refactor to avoid unsafe array iteration #36771

Merged
merged 0 commits into from
Jan 6, 2021

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Jan 4, 2021

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the tty Issues and PRs related to the tty subsystem. label Jan 4, 2021
lib/tty.js Outdated
@@ -132,7 +132,7 @@ WriteStream.prototype._refreshSize = function() {
this.emit('error', errors.errnoException(err, 'getWindowSize'));
return;
}
const [newCols, newRows] = winSize;
const { 0: newCols, 1: newRows } = winSize;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supposed to be more efficient?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really (it's probably equivalent performance wise), it's to avoid calling user-mutable Array.prototype[Symbol.iterator] and %ArrayIteratorPrototype%.next.

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jan 5, 2021
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 5, 2021
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot
Copy link
Collaborator

@aduh95
Copy link
Contributor Author

aduh95 commented Jan 6, 2021

Landed in b12127a

@aduh95 aduh95 closed this Jan 6, 2021
@aduh95 aduh95 merged commit b12127a into nodejs:master Jan 6, 2021
@aduh95 aduh95 deleted the tty-array-iteration branch January 6, 2021 12:03
danielleadams pushed a commit that referenced this pull request Jan 12, 2021
PR-URL: #36771
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Pooja D P <[email protected]>
@danielleadams danielleadams mentioned this pull request Jan 12, 2021
targos pushed a commit that referenced this pull request May 25, 2021
PR-URL: #36771
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Pooja D P <[email protected]>
targos pushed a commit that referenced this pull request Jun 5, 2021
PR-URL: #36771
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Pooja D P <[email protected]>
targos pushed a commit that referenced this pull request Jun 11, 2021
PR-URL: #36771
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Pooja D P <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. tty Issues and PRs related to the tty subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants