We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
If you're calling this on an ActiveRecord object then the conclusion is significantly different. length pulls the array into memory and count runs a "count query". size will use the cache if available and the count query if no cache is available.
Clearly explained. Thanks!!
Thanks Prabhakar!
Thanks!!!
Number 3 method 2. you mean to say there are 3 elements that have a value = 7
Yes Freddy, that is correct.
One thing to consider is that the Enumerable module does not include #size. You have to use #count (which enumerates over the items). This can be costly so you need to be careful.