From: Phlip Date: 2008-09-21T07:17:02+09:00 Subject: Re: for or each? Joe W�lfel wrote: > It's interesting that array access using 'each' seems to be much > faster on my machine. Does 'for' reevaluate its range after each tick? That would give 'for' a single technical advantage over .each, in the very rare chance you need that. Otherwise, where does the time go? A quick experiment with RubyNode just showed Ruby generates different opcodes for 'each' and 'for'. (By contrast, the notorious ternary operator, ? :, generates the same opcodes as an equivalent 'if then else end' construction.) -- Phlip