[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How fast does your Ruby run?

SpringFlowers AutumnMoon

9/20/2007 10:50:00 PM

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 via http://www.ruby-....

98 Answers

Todd Burch

9/20/2007 11:15:00 PM

0

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.
>

I just ate your lunch. MacPro 3ghz dual duo 2gb ram.

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

Todd
--
Posted via http://www.ruby-....

Jeremy Woertink

9/20/2007 11:23:00 PM

0

Todd Burch 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.
>>
>
> I just ate your lunch. MacPro 3ghz dual duo 2gb ram.
>
> 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
>
> Todd

HAHAH. I love it! awesome.

time for my sad reality. I think you just ate my lunch too :(

C:\>ruby calculate.rb
55

Ruby 1.8.6 patch 0 on i386-mswin32
It took 22.359 seconds to run. 44724 iterations per
second.


Intel 2.8 GHz 1.5Gb RAM WinXP

~Jeremy


--
Posted via http://www.ruby-....

Todd Burch

9/20/2007 11:35:00 PM

0

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

--
Posted via http://www.ruby-....

Wilson Bilkovich

9/20/2007 11:51:00 PM

0

On 9/20/07, SpringFlowers AutumnMoon <summercoolness@gmail.com> 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:
>

As you are seeing, ruby 1.8.x is painfully slow on Windows. =(

Eric Hodel

9/20/2007 11:54:00 PM

0

On Sep 20, 2007, at 16:15, Todd Burch 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.
>>
>
> I just ate your lunch. MacPro 3ghz dual duo 2gb ram.
>
> 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

pwn!

$ pbpaste | ruby19
55

Ruby 1.9.0 patch 0 on i686-darwin8.10.1
It took 2.838405 seconds to run. 352310 iterations per
second.

2.16GHz Core 2 Duo

--
Poor workers blame their tools. Good workers build better tools. The
best workers get their tools to do the work for them. -- Syndicate Wars



Chad Perrin

9/21/2007 12:13:00 AM

0

On Fri, Sep 21, 2007 at 08:15:22AM +0900, Todd Burch 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.
> >
>
> I just ate your lunch. MacPro 3ghz dual duo 2gb ram.
>
> 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

FreeBSD 6.2-RELEASE on a Pentium M/Centrino 1.7GHz Thinkpad R52:

> ruby calculate.rb
55

Ruby 1.8.6 patch 0 on i386-freebsd6
It took 16.125757 seconds to run. 62012 iterations per
second.

--
CCD CopyWrite Chad Perrin [ http://ccd.ap... ]
Amazon.com interview candidate: "When C++ is your hammer, everything starts
to look like your thumb."

Reid Thompson

9/21/2007 12:14:00 AM

0

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.

Chad Perrin

9/21/2007 12:18:00 AM

0

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.ap... ]
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."

Reid Thompson

9/21/2007 12:20:00 AM

0

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


Todd Burch

9/21/2007 12:40:00 AM

0

Eric Hodel wrote:
>
> pwn!
>
> $ pbpaste | ruby19
> 55
>
> Ruby 1.9.0 patch 0 on i686-darwin8.10.1
> It took 2.838405 seconds to run. 352310 iterations per
> second.
>
> 2.16GHz Core 2 Duo

OOOOUCH!!! Ruby 1.9.0 is HOT!
--
Posted via http://www.ruby-....