Skip to content

Always compute Enumerable#count through enumeration for 1.9+#979

Merged
headius merged 1 commit intojruby:masterfrom
dmarcotte:fix-count
Aug 31, 2013
Merged

Always compute Enumerable#count through enumeration for 1.9+#979
headius merged 1 commit intojruby:masterfrom
dmarcotte:fix-count

Conversation

@dmarcotte
Copy link
Contributor

Looks like MRI dropped the #size optimization in #count in 1.9.2. Comparing the 1.8 doc to the 2.0 doc also shows this is the intended behavior (interestingly, the 1.9 doc seems to be out of date)

Update to match that behavior (also fixes #922).

Starting in 1.9, #count is always computed through enumeration
headius added a commit that referenced this pull request Aug 31, 2013
Always compute Enumerable#count through enumeration for 1.9+
@headius headius merged commit a4f8fca into jruby:master Aug 31, 2013
@headius
Copy link
Member

headius commented Aug 31, 2013

Thanks! Do you think you'll be able to look into enumerator_with_size logic too?

@dmarcotte
Copy link
Contributor Author

Absolutely. Might be a couple of weeks before I can send it, but it's definitely coming.

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.

Enumerator#count returns nil

2 participants