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

Fix access to "-1" property on nodesOut array. #6582

Merged
merged 1 commit into from Oct 29, 2017

Conversation

Projects
None yet
3 participants
@bmeurer
Member

bmeurer commented Oct 28, 2017

Similar to the fixes in #6580 and #6581, accesses of the form

nodesOut[nodesOut.length - 1]

where nodesOut can be an empty array, are bad for performance in Node.
In this particular case it's easy to restructure the code a bit to not
require the array access at all, but just track the current tail as we
go.

This is a non-breaking performance fix.

Fix access to "-1" property on nodesOut array.
Similar to the fixes in #6580 and
#6581, accesses of the form

```js
nodesOut[nodesOut.length - 1]
```

where `nodesOut` can be an empty array, are bad for performance in Node.
In this particular case it's easy to restructure the code a bit to not
require the array access at all, but just track the current `tail` as we
go.

This is a non-breaking performance fix.
@babel-bot

This comment has been minimized.

Show comment
Hide comment
@babel-bot

babel-bot Oct 28, 2017

Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/5514/

Collaborator

babel-bot commented Oct 28, 2017

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/5514/

@hzoo

hzoo approved these changes Oct 29, 2017

awesome!

@hzoo hzoo merged commit 5baa361 into babel:master Oct 29, 2017

4 checks passed

babel/repl REPL preview is available
Details
ci/circleci Your tests passed on CircleCI!
Details
codecov/project 86.94% (target 80%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@hzoo hzoo added the PR: Polish 💅 label Nov 6, 2017

@lock lock bot added the outdated label May 1, 2018

@lock lock bot locked as resolved and limited conversation to collaborators May 1, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.