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"
--
Posted via http://www.ruby-forum.com/.

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-forum.com/\.

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

···

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:

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.

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:

···

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

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.

···

On Sep 21, 10:49 am, SpringFlowers AutumnMoon <summercooln...@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:

--------

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

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:

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

···

Le 21 septembre à 00:49, SpringFlowers AutumnMoon a écrit :

How fast does your Ruby run?

--
Sometimes everything is wrong. Now it's time to sing along. When your
day is night alone, (hold on, hold on) If you feel like letting go,
(hold on) When you think you've had too much of this life, well hang
on. (R.E.M., Everybody Hurts)

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.

···

2007/9/21, SpringFlowers AutumnMoon <summercoolness@gmail.com>:

How fast does your Ruby run?

--
Jaime Iniesta
http://jaimeiniesta.com - http://railes.net

3GHz Intel P4, HT

Ruby 1.8.5 on i386-mswin32
It took 30.141 seconds to run. 33177 iterations per
second.

Ruby 1.8.6 on i386-mswin32
It took 22.422 seconds to run. 44599 iterations per
second.

···

On Sep 20, 4:49 pm, SpringFlowers AutumnMoon <summercooln...@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:

MacBook Pro 2.16 GHz

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

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

Seeing other 1.9 speeds got me to install it.

Chris

···

On Sep 20, 4:49 pm, SpringFlowers AutumnMoon <summercooln...@gmail.com> wrote:

How fast does your Ruby run?

How fast does your Ruby run?

Hand built 1.8.6 on 2ghz MacBook, 1gig ram:

RubyMate r6354 running Ruby r1.8.6 (/usr/local/bin/ruby)

test.rb

55

Ruby 1.8.6 patch 0 on i686-darwin8.10.1
It took 9.495808 seconds to run. 105309 iterations persecond.

···

On 9/21/07, SpringFlowers AutumnMoon <summercoolness@gmail.com> wrote:

P-III 700MHz, 384 megs of ram

55

It took 0.122343 seconds to run. 8173741 iterations per second.

It's a C version though *ducks*

···

On 9/21/07, SpringFlowers AutumnMoon <summercoolness@gmail.com> wrote:

How fast does your Ruby run?

I got 53648 iterations per second running the following program,

Intel Dual core 3.2 GHz, Win XP machine

Ruby 1.8.6 patch 0
It took 14.344 seconds to run. 69715 iterations per second.

I am SO embarrassed.

···

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

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"

55

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

this is on a 3.2Ghz with HT, VISTA, guess vista is slower than XP

···

--
Posted via http://www.ruby-forum.com/\.

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"

Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz 800MHz FSB
Ubuntu 7.04

Ruby1.8.5 on i486-Linux
It took 17316402 seconds to run. 58261 iterations per second.

Ruby1.9.0 on i686-Linux
It took 2.24857 seconds to run. 4447227 iterations per second.

···

--
Posted via http://www.ruby-forum.com/\.

Hi,

How fast does your Ruby run?

Ruby 1.8.5 patch 12 on powerpc-darwin8.8.0
It took 38.723017 seconds to run. 25824 iterations per
second.

PowerPC G4, 1.42 GHz :wink:

Julian

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.

Gotta love the Mac:

55

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

Not as fast and Todd's but still a screamer... :wink:

···

--
Posted via http://www.ruby-forum.com/\.

cfp:~ > cat a.rb
require 'narray'

n = 1_000_000
t = nil

start_time = Time.now

n.times{ t = NArray.int(10).indgen!(1).sum }

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"

cfp:~ > ruby a.rb
55

2GHz osx

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

a @ http://codeforpeople.com/

···

On Sep 20, 2007, at 4:49 PM, 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"

--
we can deny everything, except that we have the possibility of being better. simply reflect on that.
h.h. the 14th dalai lama

windows xp. intel core2 1.86GHz

JRUBY:

C:\jruby\jruby-trunk\bin>jruby calculate.rb
55

It took 41.125 seconds to run. 24316 iterations per
second.

Not so good. Let's disable ObjectSpace:
C:\jruby\jruby-trunk\bin>jruby -O calculate.rb
55

It took 11.109 seconds to run. 90017 iterations per
second.

That was good. Now let's give it some more juice:
C:\jruby\jruby-trunk\bin>jruby -J-server -O calculate.rb
55

It took 5.75 seconds to run. 173913 iterations per
second.

···

--------------------------------------------
MRI:One-Click
ruby calculate.rb
55

Ruby 1.8.6 patch 0 on i386-mswin32
It took 15.828 seconds to run. 63179 iterations per
second.
--
Posted via http://www.ruby-forum.com/.