From: Chad Perrin Date: 2007-09-21T09:17:34+09:00 Subject: Re: How fast does your Ruby run? On Fri, Sep 21, 2007 at 08:35:16AM +0900, Todd Burch wrote: > Todd Burch wrote: > > SpringFlowers AutumnMoon wrote: > >> How fast does your Ruby run? > > > Ruby 1.8.2 on universal-darwin8.0 > > It took 6.383342 seconds to run. 156657 iterations per second. > > > > (I had to take out RUBY_PATCHLEVEL, as that's not defined, but I suspect > > I could have put a begin/rescue/end in around and STILL have eaten your > > lunch. LOLOLOLOL > > > > Ruby 1.8.2 on universal-darwin8.0 > It took 5.920011 seconds to run. 168918 iterations per second. > > I changed the scope of x & y and eeked out some more speed. > > x, y = nil > for i in 1..n > t = (1..10).inject {|x, y| x + y } > end That cut almost three full seconds off my time -- down to 13.829852 seconds to run, at 72307 iterations per second. Obviously, you're still kicking the crap out of my poor little Pentium M. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] Phillip J. Haack: "Productivity is not about speed. It's about velocity. You can be fast, but if you're going in the wrong direction, you're not helping anyone."