-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Enable Performance/ChainArrayAllocation
cop
#8404
Conversation
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.
Tests pass, looks like it's safe to mutate in those methods.
The gain is hard to notice in our test suite.
Thanks for the review @DirtyF :) That said, I'll wait to see if @parkr or @mattr- sees something we missed or overlooked |
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.
This is looking good! I left a couple comments about some optimizations we might be able to make here.
Requires #8408 to be reviewed and merged first... |
@jekyllbot: merge +fix |
Summary
RuboCop Performance has a cop that allows detecting method chains that duplicate starting array with each chain segment.
But the cop is disabled by default.
This pull request enables the cop and fixes offenses reported by it by switching non-mutating methods with mutating counterparts.