From: Phlip Date: 2008-09-21T07:52:06+09:00 Subject: Re: for or each? Joe W�lfel wrote: > You can try my test if you like. I haven't checked it carefully. > But it does seem like 'each' is much faster under both ruby 1.86 and > ruby 1.9. The code is below. I just experimented with 'for' and found it does not reevaluate its header each time it runs. That's the only thing that could have explained the time difference, so maybe Matz & Co. have simply neglected 'for' while optimizing .each, which everyone uses. (Though it's still technically superior; not just an /ad populum/ thing...) Another reason to use .each is your collection-like class might override it to do something cool...