-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Conversation
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.
This comment has been minimized.
This comment has been minimized.
Landed in b12127a |
f808e31
to
b12127a
Compare
PR-URL: #36771 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Pooja D P <Pooja.D.P@ibm.com>
PR-URL: #36771 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Pooja D P <Pooja.D.P@ibm.com>
PR-URL: #36771 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Pooja D P <Pooja.D.P@ibm.com>
PR-URL: #36771 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Pooja D P <Pooja.D.P@ibm.com>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes