How fast does your Ruby run?

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"

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

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

On 9/20/07, SpringFlowers AutumnMoon removed_email_address@domain.invalid 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. =(

On Sep 20, 2007, at 16:15, Todd B. wrote:

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

Todd B. 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 :frowning:

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

SpringFlowers AutumnMoon wrote:

Ruby 1.8.6 patch 0 on i386-mswin32
end
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.

On Fri, Sep 21, 2007 at 08:15:22AM +0900, Todd B. wrote:

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.

On Fri, Sep 21, 2007 at 08:35:16AM +0900, Todd B. wrote:

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.

Reid T. wrote:

t = (1…10).inject {|x, y| x + y }
puts
55
c:/cygwin/home/rthompso/howquick.rb:14: uninitialized constant
-------------native ruby same box updated to 1.8.6----------

It took 9.702104 seconds to run. 103070 iterations per
second.
forgot the processor speed for the linux core2 duo
model name : Intel® Core™2 CPU 6320 @ 1.86GHz

Eric H. 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!

On Sep 20, 6:49 pm, SpringFlowers AutumnMoon
removed_email_address@domain.invalid 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:

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 :slight_smile:

Charles Oliver N. wrote:

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

Todd B. wrote:

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.

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

On 9/21/07, Charles Oliver N. removed_email_address@domain.invalid wrote:

Wow my work machine is really bad
A 2.6Ghz on XP with 512M

55

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

On Sep 21, 10:49 am, SpringFlowers AutumnMoon
removed_email_address@domain.invalid wrote:

Ruby 1.8.6 patch 0 on i386-mswin32
end
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.

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:

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

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.

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… :slight_smile:

  • 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

2007/9/21, SpringFlowers AutumnMoon removed_email_address@domain.invalid:

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

Sponsor our Newsletter | Privacy Policy | Terms of Service