From: "geoffness8@..." Date: 2007-09-21T18:15:05+09:00 Subject: Re: How fast does your Ruby run? On Sep 21, 10:49 am, SpringFlowers AutumnMoon wrote: > How fast does your Ruby run? > > I got 53648 iterations per second running the following program, > on an Intel 3.2 GHz HT, Win XP machine: > > -------- > > C:\> ruby calculate.rb > 55 > > Ruby 1.8.6 patch 0 on i386-mswin32 > It took 18.64 seconds to run. 53648 iterations per second. > > -------- > > n = 1_000_000 > > start_time = Time.now > > for i in 1..n > t = (1..10).inject {|x, y| x + y } > end > > finish_time = Time.now > > p t > > puts > print "Ruby ", RUBY_VERSION, " patch ", RUBY_PATCHLEVEL, " on ", > RUBY_PLATFORM > > puts > print "It took #{finish_time - start_time} seconds to run." > print " #{(n / (finish_time - start_time)).to_i} iterations per > second.\n" > -- > Posted viahttp://www.ruby-forum.com/. AMD 2.8 GHz Ubuntu 7.04 2 GB RAM geoff@geoff-laptop:~/prog/ruby$ ruby calculate.rb 55 Ruby 1.8.6 patch 0 on i686-linux It took 13.012441 seconds to run. 76849 iterations per second. And then with the addition of x, y = nil geoff@geoff-laptop:~/prog/ruby$ ruby calculate.rb 55 Ruby 1.8.6 patch 0 on i686-linux It took 12.135616 seconds to run. 82402 iterations per second.