Skip to content

Don't dup every element in Enumerator#drop (9K)#4225

Merged
headius merged 1 commit intojruby:masterfrom
iconara:fix-4218-9k
Nov 8, 2016
Merged

Don't dup every element in Enumerator#drop (9K)#4225
headius merged 1 commit intojruby:masterfrom
iconara:fix-4218-9k

Conversation

@iconara
Copy link
Contributor

@iconara iconara commented Oct 13, 2016

This fixes #4218 in JRuby 9K.

In 06f0441 (JRUBY-6892) Enumerable#drop was changed to call #dup on every element that ended up in the result, but that might not work. Not all objects correctly implement #dup, or are even allocatable.

#take was not changed, and looking at the differences between #take and #drop the only thing that stood out was that the signature of the #each call was different. Changing from Signature.NO_ARGUMENTS to Signature.ONE_REQUIRED make the issue that 06f0441 tried to fix go away.

In 06f0441 (JRUBY-6892) Enumerable#drop was changed to call #dup on every element that ended up in the result, but that might not work. Not all objects correctly implement #dup, or are even allocatable.

#take was not changed, and looking at the differences between #take and #drop the only thing that stood out was that the signature of the #each call was different. Changing from Signature.NO_ARGUMENTS to Signature.ONE_REQUIRED make the issue that 06f0441 tried to fix go away.
@iconara iconara changed the title Don't dup every element in Enumerator#drop Don't dup every element in Enumerator#drop (9K) Oct 13, 2016
@kares kares added this to the JRuby 9.1.6.0 milestone Oct 18, 2016
@headius headius merged commit 4e775c7 into jruby:master Nov 8, 2016
@headius
Copy link
Member

headius commented Nov 8, 2016

Our CI went red for a while, so I pulled locally and ran a couple suites. Things look good. Merged.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enumerable#drop calls #dup on every element

3 participants