On 22 June 2011 19:55, Marc-Andre Lafortune <ruby-core / marc-andre.ca> wrote: > The method `to_ary` is for classes that can be implicitly converted to an Array. This doesn't apply to NilClass. > > I'm also highly sceptical as to the actual real life impact of such an optimization. I agree with you, such optimization is not worth it. But, for the sake of curiosity, I did my own benchmark. The numbers are (optArray doing the nil check, for 1 000 000 calls): Array(nil) 0.487444 optArray(nil) 0.234128 Array(Object.new) 0.462688 optArray(Object.new) 0.467910 It is 2 times faster for nil, and does not seem to impact the performance for other objects. But the real gain is 0.2s on 1 million calls, which should never happen in real life (or then it would be insignificant compared to the total time to run).