How fast does your Ruby run?

  • Thread starter SpringFlowers AutumnMoon
  • Start date
S

SpringFlowers AutumnMoon

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"
 
T

Todd Burch

SpringFlowers said:
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
 
J

Jeremy Woertink

Todd said:
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
 
T

Todd Burch

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
 
W

Wilson Bilkovich

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. =(
 
E

Eric Hodel

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
 
C

Chad Perrin

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

Reid Thompson

SpringFlowers said:
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.
 
C

Chad Perrin

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

Reid Thompson

Reid said:
SpringFlowers said:
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
 
T

Todd Burch

Eric said:
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!
 
B

Brian Adkins

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:

Dual Core AMD Opteron 270 2GHz
Ruby 1.8.5 on i486-linux
It took 19.373381 seconds to run. 51617 iterations per second.

Not too fast, but I do have a couple of Western Digital (WD1500ADFD)
drives, so the I/O screams :)
 
C

Charles Oliver Nutter

Todd said:
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.

MacBook Pro 2.1G. I tried both Ruby and JRuby.

JRuby:

Ruby 1.8.5 patch 3876 on java
It took 8.022 seconds to run. 124657 iterations per second.

Ruby:

Ruby 1.8.6 patch 0 on i686-darwin8.9.1
It took 10.262067 seconds to run. 97446 iterations per second.

- Charlie
 
C

Charles Oliver Nutter

Charles said:
MacBook Pro 2.1G. I tried both Ruby and JRuby.

JRuby:

Ruby 1.8.5 patch 3876 on java
It took 8.022 seconds to run. 124657 iterations per second.

Ruby:

Ruby 1.8.6 patch 0 on i686-darwin8.9.1
It took 10.262067 seconds to run. 97446 iterations per second.

I also tried Ruby 1.9 and Rubinius, but Rubinius crashed.

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

- Charlie
 
G

geoffness8

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

Josip Gracin

SpringFlowers said:
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:

Here's something interesting. The processor is Intel T7200 @ 2.00GHz,
Linux Ubuntu.

1. With ruby 1.8.5. which comes packaged with Ubuntu:

Ruby 1.8.5 on i486-linux
It took 20.346013 seconds to run. 49149 iterations per
second.

2. With ruby 1.9.0 (2006-06-08) which comes packaged in Ubuntu:

Ruby 1.9.0 on i486-linux
It took 23.875774 seconds to run. 41883 iterations per
second.


3. With ruby 1.8.6 compiled from sources on the machine:

Ruby 1.8.6 on i686-linux
It took 7.107875 seconds to run. 140689 iterations per
second.


Obviously, the target instruction set matters quite a lot. I think I'll
be compiling my own ruby from now on. :)
 
G

gga

Seems like a pretty silly test, but okay...

$ unset RUBYOPT && ruby1.8 /home/gga/bin/ruby/speed_test.rb && ./ruby /
home/gga/bin/ruby/speed_test.rb && echo && uname -a

Ruby 1.8.5 on x86_64-linux
It took 14.754958 seconds to run. 67773 iterations per second.

Ruby 1.9.0 on x86_64-linux
It took 2.558372 seconds to run. 390873 iterations per second.

Linux aura1 2.6.17-10-generic #2 SMP Tue Dec 5 21:16:35 UTC 2006
x86_64 GNU/Linux
AMD 4400 2CPUs.
 
F

F. Senault

Le 21 septembre à 00:49, SpringFlowers AutumnMoon a écrit :
How fast does your Ruby run?

Ok. Since I can't possibly win this DSW, I'll try this on my slowest
machines... :)

- AMD Athlon 1.4GHz (quite busy server) :

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

Aaand...

- PIII 500MHz (diskless workstation with very limited RAM - especially
raised from the dead just for you, people !) :

Ruby 1.8.4 patch ? on i386-freebsd6
It took 202.375195 seconds to run. 4941 iterations per second.

(Wooot !)

BTW, on the other direction :

- AMD Opteron 244 1.8GHz :

Ruby 1.8.6 patch 0 on amd64-freebsd6
It took 12.838229 seconds to run. 77892 iterations per second.

Fred
 
I

Imobach González Sosa

Hi all,

Ok, here's some more numbers (comparing ubuntu pre-compiled, compiled
from sources and development version):

* Ruby 1.8.5 shipped with Ubuntu: 30.871182 seconds
* Ruby 1.8.5 compiled from sources: 12.173341 seconds (wooh, what a difference!)
* Ruby 1.8.6 compiled from sources: 11.238127
* Ruby 1.9.0 (downloaded today from ruby-lang.org and compiled from
sources): 3.561564

All the tests have been run on an Intel(R) Pentium(R) D CPU 2.80GHz
running Kubuntu Linux 7.04 (Feisty Fawn).

See ya!
 
J

Jaime Iniesta

2007/9/21 said:
How fast does your Ruby run?

Hi, here are my results:

**** Ubuntu GNU/Linux on a Thinkpad R52 (Intel Celeron 1.4 Ghz)

$ ruby calculate.rb
55

Ruby 1.8.5 on i486-linux
It took 20.216099 seconds to run. 49465 iterations per
second.

**** MacBook (intel dual core)

$ ruby calculate.rb
55

Ruby 1.8.2 on universal-darwin8.0
It took 11.872489 seconds to run. 84228 iterations per
second.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top