How fast does your Ruby run?

  • Thread starter SpringFlowers AutumnMoon
  • Start date
J

Joel VanderWerf

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

The --enable-pthread might be for compatibility with the tcl/tk package
(IIRC correctly, they should either both use it or both not use it).
 
R

Rick DeNatale

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

I'm not bashing Debian in general, just the Debian approach to Ruby packaging.

In general I'm quite happy with Debian/Ubuntu, but not with deb packaged Ruby.
 
T

Tomas Pospisek's Mailing Lists

I'm not bashing Debian in general, just the Debian approach to Ruby packaging.

In general I'm quite happy with Debian/Ubuntu, but not with deb packaged Ruby.

Shall I bite?

So what's wrong with Debian's Ruby packaging and what would be the proper
way? (AFAIcan see the above problem doesn't have anything to do with
Debian's packaging but instead with a compile flag?)
*t
 
X

xx xx

So what's wrong with Debian's Ruby packaging and what would be the
proper
way? (AFAIcan see the above problem doesn't have anything to do with
Debian's packaging but instead with a compile flag?)
*t


Probably it depends on architecture of the binary-package which was
prepared for.
it's too "universal". for example binary packages are made por i386 ,
not for i686.
 
M

Mahen Surinam

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"





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
 
M

Michael Greenly

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"

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

Julian Raschke

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

Julian
 
C

Chad Perrin

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.

Is that missing a decimal point after the 17?
 
D

David Orriss Jr

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.

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... ;)
 
S

SpringFlowers AutumnMoon

The performance gain I got from Ruby 1.8.6 to Ruby 1.9 is only from
about 52,000 iterations per second to 58,000... I wonder why other
people get so big performance gain instead. is it because they compile
their only Ruby 1.9.

I downloaded the Ruby 1.9 from

Ruby 1.9.0 Binary (md5: 9809f6e9bc7795f83612b369e36c8724) Developer
version (experimental)

in http://www.ruby-lang.org/en/downloads/

for the Win XP version.
 
R

Robert McGovern

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.

Followup, with the newly released 1.8.6p100

robert-mcgoverns-computer:~/Documents/Programming robertmcgovern$ ruby test.rb
55

Ruby 1.8.6 patch 110 on i686-darwin8.10.1
It took 9.955669 seconds to run. 100445 iterations persecond.

Slightly slower, running on battery but I don't think it makes any difference.

Rob
 
T

Tomas Pospisek's Mailing Lists

Probably it depends on architecture of the binary-package which was
prepared for.
it's too "universal". for example binary packages are made por i386 ,
not for i686.

However the data I have available indicate that compiling ruby for i486
(afaik Debian compiles for i486 and not i386) instead of against i686
doesn't matter much:

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.

Which would make a difference of rougly 4%.

Am I misstaken?

Anything else that sucks so bad with Debian packaging?
*t
 
T

Tomas Pospisek's Mailing Lists

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.

Are you certain?!?!? That would be a 100 fold improvement?!!?!?!
?!?!
*t
 
R

Ricardo Martins

--pWyiEgJYm5f9v55/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Are you certain?!?!? That would be a 100 fold improvement?!!?!?!
?!?!
*t

I guess he typed the results instead of copying and pasting, judging
by the missing period after 17 in the first result; so that may be a
typo too.

Anyway, here it goes:

Intel(R) Pentium(R) M processor 2.00GHz
Arch Linux

Ruby 1.8.6 patch 36 on i686-linux
It took 16.125842 seconds to run. 62012 iterations per second.

Ruby 1.9.0 patch 0 on i686-linux
It took 2.505766 seconds to run. 399079 iterations per second.
--=20
Ricardo Martins ><>< scarybox.net ><>< b.scarybox.net
GPG key: 0x1308F1B4 http://scarybox.net/zomg/ricardo.asc

--pWyiEgJYm5f9v55/
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQFG9uGAkH81LRMI8bQRAsflAJ9FHZBq8605323ALobCzd0TWMowfQCfZ1Ly
m7HG/ipD7WeUbcqHhmCqoxY=
=GO4m
-----END PGP SIGNATURE-----

--pWyiEgJYm5f9v55/--
 
L

Lloyd Linklater

SpringFlowers said:
The performance gain I got from Ruby 1.8.6 to Ruby 1.9 is only from
about 52,000 iterations per second to 58,000... I wonder why other
people get so big performance gain instead. is it because they compile
their only Ruby 1.9.

If that is true, then is the release version specifically compiled to be
slow? Which compiler is the best and which settings to use for a "roll
your own" ruby for windows? Unix?
 
M

M. Edward (Ed) Borasky

Lloyd said:
If that is true, then is the release version specifically compiled to be
slow? Which compiler is the best and which settings to use for a "roll
your own" ruby for windows? Unix?

As far as I've been able to determine, with gcc, the compiler settings
should be "-O3 -march=<architecture>", where <architecture> is the chip
name, for example "-O3 -march=athlon64". There doesn't seem to be much
gain from going from O2 to O3, but it's non-zero. The tests I've looked
at indicate that it's the "-march" piece that does the real job.
Incidentally, I saw a post go by somewhere that had "-march= -mcpu=
-mtune=" flags all set. The only one you want is "-march" -- the others
are redundant or ignored or both.

See http://www.jhaampe.org/software/ruby-gcc for the details.

I can't help you with the Microsoft or other Windows compilers. Cygwin
or MSYS/MinGW compiling, on the other hand, should work the same way as
Linux -- you've got gcc, so use "-march=" and "-O3".
 
P

Paul Brannan

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.

What does it look like without --enable-pthread?

Paul
 
J

Josip Gracin

Paul said:
What does it look like without --enable-pthread?

Without --enable-pthread, it still gets linked with libpthread.so. And
performs as mentioned.

If I put --disable-pthread, the compile fails, saying "No rule to make
target thread_.h, needed by error.o".
 
P

Paul Brannan

Without --enable-pthread, it still gets linked with libpthread.so. And
performs as mentioned.

If I put --disable-pthread, the compile fails, saying "No rule to make
target thread_.h, needed by error.o".

Oh, silly me :) -- YARV uses pthread for its threading now, so of course
it won't work without it.

I wonder if it will build with GNU pth?

Paul
 
J

jzakiya

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

--------------------------------------------------
n = 1_000_000

start_time = Time.now

for i in 1..n
t = (1..10).inject {|x, y| x + y }
end

run_time = start_time - Time.now

p t

puts
print "Ruby ", RUBY_VERSION, " patch ", RUBY_PATCHLEVEL, " on ",
RUBY_PLATFORM

puts
print "It took #{runt_time} seconds to run."
print " #{(n / run-time).to_i} iterations per
second.\n"
--
 

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
474,109
Messages
2,570,670
Members
47,260
Latest member
MadelaineK

Latest Threads

Top