How fast does your Ruby run?

  • Thread starter SpringFlowers AutumnMoon
  • Start date
J

Jaime Iniesta

After submitting the results for my local machines, I thought it would
be a good idea to test some servers I work with. Here it goes:

*** Dreamhost shared hosting

$ ruby calculate.rb
55

Ruby 1.8.5 on i386-linux
It took 36.407013 seconds to run. 27467 iterations per
second.


*** Textdrive shared hosting

$ ruby calculate.rb
55

Ruby 1.8.4 on i386-freebsd5
It took 22.436537 seconds to run. 44570 iterations per
second.
 
M

M. Edward (Ed) Borasky

Josip said:
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. :)

Make sure you use the appropriate "march=" flag when you do. See
http://www.jhaampe.org/software/ruby-gcc for the details.
 
F

F. Senault

Le 21 septembre à 12:14, F. Senault a écrit :
- 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.

Forgot one :

- Intel Celeron 633MHz (short on RAM too) :

Ruby 1.8.6 patch 0 on i386-freebsd5
It took 105.835886 seconds to run. 9448 iterations per second.

(And that one is an important production machine, nothing less !)

Fred
 
P

Phrogz

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:

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

Brian Adkins

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!)

That's amazing. Are you sure the only difference was pre-built Ruby
vs. built-from-source? That just seems like too big of a difference.
 
C

Chris Shea

How fast does your Ruby run?

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
 
K

Konrad Meyer

--nextPart2924231.RBMWI8Pfm3
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Quoth F. Senault:
Le 21 septembre =E0 12:14, F. Senault a =E9crit :
=20
=20
Forgot one :
=20
- Intel Celeron 633MHz (short on RAM too) :
=20
Ruby 1.8.6 patch 0 on i386-freebsd5
It took 105.835886 seconds to run. 9448 iterations per second.
=20
(And that one is an important production machine, nothing less !)
=20
Fred
--=20
Welcome my son, welcome to the machine.
What did you dream? It's alright we told you what to dream.
You dreamed of a big star, he played a mean guitar.
(Pink Floyd, Welcome to the Machine)

Pentium 133MHz w/ 128MiB of ram (my router) running ruby from FC6 updates:

Ruby 1.8.5 patch 52 on i386-linux
It took 2644.671185 seconds to run. 378 iterations per second.

=2D-=20
Konrad Meyer <[email protected]> http://konrad.sobertillnoon.com/

--nextPart2924231.RBMWI8Pfm3
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBG9CKxCHB0oCiR2cwRAuqEAKDY5L6ET5t9Hel3ETd9eBqrAywGawCgxwv5
f9C+tx594Uw1/mn5UVOUDEc=
=H+/e
-----END PGP SIGNATURE-----

--nextPart2924231.RBMWI8Pfm3--
 
T

Tomas Pospisek's Mailing Lists

--8323328-1722198387-1190405407=:4979
Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1722198387-1190405407=:4979"

This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.

--8323328-1722198387-1190405407=:4979
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE
Content-ID: <Pine.LNX.4.64.0709212210401.4979@localhost>

erence!)

That's amazing. Are you sure the only difference was pre-built Ruby
vs. built-from-source? That just seems like too big of a difference.

I was also amyazed. The original poster could actually find out quite=20
easily whether the improvement comes from recompiling:

# apt-get build-dep ruby1.8
# apt-get source ruby1.8
# cd ruby1.8*
# dpkg-buildpackage -rfakeroot

This will build a package that's *not* optimized for the local=20
architecture. In order to do the latter he will need to change the=20
config/compile options in debian/rules.
*t
 
R

Robert McGovern

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)
55

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

Fi Su

hello !

My hardware:
Laptop Asus A6TC - Debian Sid i386
AMD Thurion64x2

uname -a:
Linux adom 2.6.22.5 #1 SMP Wed Aug 29 01:16:06 CEST 2007 i686 GNU/Linux

---------------
tests:


1) ruby compiled by :
# apt-get build-dep ruby1.9
# apt-get source ruby1.9

Ruby 1.9.0 patch 0 on i686-linux
It took 9.170000 seconds to run. 269313 iterations per
second.

2) ruby from source (cvs) !!!
Ruby 1.9.0 patch 0 on i686-linux
It took 3.713144 seconds to run. 269313 iterations per
second.

3) ruby from repository (without optimalization)
Ruby 1.9.0 patch 0 on i686-linux
It took 9.500020 seconds to run. 269313 iterations per
second.

4) ruby from repository
Ruby 1.8.6 patch 0 on i686-linux
It took 25.030340 seconds to run. 269313 iterations per
second.


Summary: Do I need to try gentoo ? ;)
 
I

Ilmari Heikkinen

How fast does your Ruby run?

I got 53648 iterations per second running the following program,

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*
 
X

xx xx

xx said:
hello !

My hardware:
Laptop Asus A6TC - Debian Sid i386
AMD Thurion64x2

uname -a:
Linux adom 2.6.22.5 #1 SMP Wed Aug 29 01:16:06 CEST 2007 i686 GNU/Linux


Sorry for "269313 iterations" in my previous post - i couldn't edit it

btw. what is a "version though *ducks* " ?
 
T

Todd Benson

Sorry for "269313 iterations" in my previous post - i couldn't edit it

btw. what is a "version though *ducks* " ?

lol. I imagine he doesn't want to get swatted by ruby purists. He
compiled into machine code instead of using the interpreter?

For what it's worth, I was able to have an 800MHz machine do 30
seconds with the 1.8.6 standard build from source by disabling the GC
in irb and loading via...

irb> load "test.rb"

Standard time during normal computer operation for executing the OP's
code was around 49+/-5 seconds. Normal operation included having a
heavy use network session mixed with X Windows open and a window
manager.

I pushed it to do less than 20 seconds by rewriting the code
(cheating) to omit the inject method, making it look ugly with while
loops, and also leaving out the puts/p/print methods.

I will confirm that it was extremely easy to beat the one-click
install on a newer/faster Windows machine with 1.8.6. Nothing against
that, though, because making a clean install of anything on Windows is
nothing less than an act of God (nothing against the Windows fans
either; it justs seems harder than it needs to be; I think this will
change eventually). I have yet to attempt Cygwin or MingW building on
a Windows system, though. I haven't tried the 1.9 installer yet,
either.

Todd
 
E

Eric Hodel

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

How can you draw that conclusion? You used three different versions
of ruby.
 
R

Reid Thompson

Todd said:
lol. I imagine he doesn't want to get swatted by ruby purists. He
compiled into machine code instead of using the interpreter?

For what it's worth, I was able to have an 800MHz machine do 30
seconds with the 1.8.6 standard build from source by disabling the GC
in irb and loading via...

irb> load "test.rb"

Standard time during normal computer operation for executing the OP's
code was around 49+/-5 seconds. Normal operation included having a
heavy use network session mixed with X Windows open and a window
manager.

I pushed it to do less than 20 seconds by rewriting the code
(cheating) to omit the inject method, making it look ugly with while
loops, and also leaving out the puts/p/print methods.

I will confirm that it was extremely easy to beat the one-click
install on a newer/faster Windows machine with 1.8.6. Nothing against
that, though, because making a clean install of anything on Windows is
nothing less than an act of God (nothing against the Windows fans
either; it justs seems harder than it needs to be; I think this will
change eventually). I have yet to attempt Cygwin or MingW building on
a Windows system, though. I haven't tried the 1.9 installer yet,
either.

Todd
I've built using cygwin several times w/out issue. Not recently though,
the setup version has been kept pretty up to date and has been speedy
enough for what I use it for. ( results are posted earlier in the thread )
 
J

Josip Gracin

Eric said:
How can you draw that conclusion? You used three different versions of
ruby.

You are right, that was one hasty conclusion.

Here are the real results, indicating how ruby was compiled:

1. CFLAGS="-O3 -mcpu=i686 -march=i686 -mtune=i686" ./configure
--target=i686-linux

Ruby 1.8.5 on i686-linux
It took 6.561333 seconds to run. 152408 iterations per
second.


2. CFLAGS="-O3 -mcpu=i486 -march=i486 -mtune=i486" ./configure
--target=i486-linux

Ruby 1.8.5 on i486-linux
It took 6.847393 seconds to run. 146040 iterations per
second.


3. CFLAGS="-O3 -mcpu=i686 -march=i686 -mtune=i686" ./configure
--target=i686-linux --enable-pthread

Ruby 1.8.5 on i686-linux
It took 17.856484 seconds to run. 56002 iterations per
second.


Note the "--enable-pthread" in the last measurement. The binary
distributed with Ubuntu is compiled with pthreads.
 
J

Josip Gracin

Josip said:
You are right, that was one hasty conclusion.

Here are the real results, indicating how ruby was compiled:

1. CFLAGS="-O3 -mcpu=i686 -march=i686 -mtune=i686" ./configure
--target=i686-linux

Ruby 1.8.5 on i686-linux
It took 6.561333 seconds to run. 152408 iterations per
second.


2. CFLAGS="-O3 -mcpu=i486 -march=i486 -mtune=i486" ./configure
--target=i486-linux

Ruby 1.8.5 on i486-linux
It took 6.847393 seconds to run. 146040 iterations per
second.


3. CFLAGS="-O3 -mcpu=i686 -march=i686 -mtune=i686" ./configure
--target=i686-linux --enable-pthread

Ruby 1.8.5 on i686-linux
It took 17.856484 seconds to run. 56002 iterations per
second.


Note the "--enable-pthread" in the last measurement. The binary
distributed with Ubuntu is compiled with pthreads.

Oh, and finally, the latest Ruby from svn...

4. CFLAGS="-O3 -mcpu=i686 -march=i686 -mtune=i686" ./configure
--enable-pthread

Ruby 1.9.0 on i686-linux
It took 2.507824 seconds to run. 398752 iterations per
second.
 
R

Rick DeNatale

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 diffe= rence!)
* 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

One more strike against using Debian packaged Ruby!

Just for fun, this is for a Macbook 2.16 GHz Intel Core 2 Duo with 1GB
or ram (Ruby was installed using macports)

55

Ruby 1.8.6 patch 0 on i686-darwin8.10.2
It took 8.688359 seconds to run. 115096 iterations per
second.

--=20
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/
 
L

Lloyd Linklater

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

Tomas Pospisek's Mailing Lists

--8323328-1040960573-1190492227=:4260
Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1040960573-1190492227=:4260"

This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.

--8323328-1040960573-1190492227=:4260
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE
Content-ID: <Pine.LNX.4.64.0709222217301.4260@localhost>

One more strike against using Debian packaged Ruby!

If I infer correctly it's rather one more strike against compiling with=20
the "--enable-pthread" switch. So while it's yet another oportunity of=20
Debian bashing I guess the more clever option would be to ask why
"--enable-pthread" sucks so bad and whether ____Ubuntu____ (note that=20
possibly Debian uses it too, I don't know) should switch it off...
*t
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top