From: Reid Thompson Date: 2007-09-21T09:19:39+09:00 Subject: Re: How fast does your Ruby run? Reid Thompson wrote: > 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" > > amd athlon 2500+XP processor (1883 MHz) 1GB ram > > -------------cygwin ruby 1.8.6---------- > ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-cygwin] > yes, that's on cygwin. > $ ruby howquick.rb > 55 > > Ruby 1.8.6 patch 0 on i386-cygwin > It took 15.816 seconds to run. 63227 iterations per > second. > > > -------------native ruby same box 1.8.5---------- > C:\ruby\bin>ruby c:\cygwin\home\rthompso\howquick.rb > 55 > > c:/cygwin/home/rthompso/howquick.rb:14: uninitialized constant > RUBY_PATCHLEVEL ( > NameError) > removed pathlevel .. > C:\ruby\bin>ruby c:\cygwin\home\rthompso\howquick.rb > 55 > > Ruby 1.8.5 on i386-mswin32 > It took 30.782 seconds to run. 32486 iterations per > second. > > -------------native ruby same box updated to 1.8.6---------- > C:\ruby\bin>ruby c:\cygwin\home\rthompso\howquick.rb > 55 > > Ruby 1.8.6 patch 0 on i386-mswin32 > It took 24.453 seconds to run. 40894 iterations per > second. > > ------------ruby 1.8.5 linux core2 duo gentoo 2gb RAM------- > rthompso@raker ~ $ ruby howquick.rb > 55 > > Ruby 1.8.5 patch 2 on i686-linux > It took 11.779449 seconds to run. 84893 iterations per > second. > > ------------updated ruby 1.8.6 same linux core2 duo 2gb RAM--- > > rthompso@raker ~ $ ruby howquick.rb > 55 > > Ruby 1.8.6 patch 36 on i686-linux > It took 9.702104 seconds to run. 103070 iterations per > second. forgot the processor speed for the linux core2 duo model name : Intel(R) Core(TM)2 CPU 6320 @ 1.86GHz