Skip to content

[Fix #396]#507

Open
pessi-v wants to merge 2 commits intorubocop:masterfrom
pessi-v:add-new-array-insert-cop
Open

[Fix #396]#507
pessi-v wants to merge 2 commits intorubocop:masterfrom
pessi-v:add-new-array-insert-cop

Conversation

@pessi-v
Copy link
Copy Markdown

@pessi-v pessi-v commented Jun 23, 2025

Use unshift instead of insert(0, ...) for better performance. The unshift method is specifically optimized for prepending elements and is faster than using insert at index 0.

Idea was taken from fast-ruby.

@pessi-v
Copy link
Copy Markdown
Author

pessi-v commented Jun 23, 2025

Ok, I think this one is ready for review!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant