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

merged 1 commit into from Aug 31, 2013


None yet

2 participants


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).

@dmarcotte dmarcotte Don't use #size for #count in 1.9+
Starting in 1.9, #count is always computed through enumeration
@headius headius merged commit a4f8fca into jruby:master Aug 31, 2013

1 check passed

Details default The Travis CI build passed
JRuby Team member

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


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

@dmarcotte dmarcotte referenced this pull request Nov 17, 2013

Fix count_spec (1.7.x) #1231

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