From: James Gray Date: 2008-12-01T01:35:41+09:00 Subject: Re: Enumerable#select used to return actual values On Nov 30, 2008, at 10:29 AM, James Gray wrote: > On Nov 30, 2008, at 4:26 AM, Robert Dober wrote: > >> On Sun, Nov 30, 2008 at 11:13 AM, David A. Black >> wrote: >> >>> There's also: >>> >>> res = [] >>> (1..10).each {|e| res << (e * e) if e > 5 } >>> res >>> >>> No shame in a local variable now and then :-) >> Not at all, and it is often the *fastest* solution as, unfortunately, >> #inject is slow. > > My opinion is that if inject() is really the biggest time sync in > your code, you're in big trouble. ;) Well, I meant big trouble if you're still looking for optimizations. If your code is instead fast enough and inject() is the biggest time sync left, you are in great shape. Either way, changing out inject() for speed seems silly to me. James Edward Gray II