How slow could ruby be compared to Python or Perl?

S

sullivanz.pku

This might be a stupid question, but I really wonder if ruby is much
slower than python and perl.
 
A

Austin Ziegler

T24gMy8zMS8wNiwgc3VsbGl2YW56LnBrdUBnbWFpbC5jb20gPHN1bGxpdmFuei5wa3VAZ21haWwu
Y29tPiB3cm90ZToKPiBUaGlzIG1pZ2h0IGJlIGEgc3R1cGlkIHF1ZXN0aW9uLCBidXQgSSByZWFs
bHkgd29uZGVyIGlmIHJ1YnkgaXMgbXVjaAo+IHNsb3dlciB0aGFuIHB5dGhvbiBhbmQgcGVybC4K
ClRyeSBpdC4gQW5kIGlnbm9yZSBhbnlvbmUgd2hvIHRlbGxzIHlvdSB0byBsb29rIGF0IHRoZSB1
dHRlcmx5IHVzZWxlc3MKQWxpb3RoIHNob290b3V0LiBJdCBkb2Vzbid0IG1vZGVsIGFueXRoaW5n
IHJlYWwtd29ybGQgYW5kIGRvZXNuJ3QKYWN0dWFsbHkgdGVsbCB5b3UgYW55dGhpbmcgYWJvdXQg
cGVyZm9ybWFuY2UgZm9yIHlvdXIgcHJvYmxlbXMuCgpJIGhhdmVuJ3QgY2hlY2tlZCBpbiBhIHdo
aWxlLCBidXQgdGhleSB3ZXJlbid0IHZlcnkgaG9uZXN0IGFib3V0IHRoZWlyCmFpbXMgbGFzdCB0
aW1lIEkgY2hlY2tlZCwgZWl0aGVyLiBJdCdzIHNpbXBseSBhIG1hdHRlciBvZgpzZWxmLXByb21v
dGlvbiBhbmQgY29tcGFyaXNvbiBmb3IgSW5hbmUgR3VsbGlibGVzLgoKLWF1c3RpbgotLQpBdXN0
aW4gWmllZ2xlciAqIGhhbG9zdGF0dWVAZ21haWwuY29tCiAgICAgICAgICAgICAgICogQWx0ZXJu
YXRlOiBhdXN0aW5AaGFsb3N0YXR1ZS5jYQo=
 
I

Isaac Gouy

Austin said:
Try it. And ignore anyone who tells you to look at the utterly useless
Alioth shootout. It doesn't model anything real-world and doesn't
actually tell you anything about performance for your problems.

I haven't checked in a while, but they weren't very honest about their
aims last time I checked, either. It's simply a matter of
self-promotion and comparison for Inane Gullibles.

-austin

"I haven't checked in a while..."
Then your comments would apply to the Alioth shootout in... 2004?

There's nothing wrong with saying how little can be learned from
measuring small programs, but saying don't look suggests there's
something to be hidden.
 
I

Isaac Gouy

Austin said:
2005. I avoid the shootout like the plague, until you pop up and
pretend that your pet project has any relevance to anything.


No, saying "don't look" says that your aims are bogus, your tests are
worse, your validation is nonsensical to nonexistent, and your
presentation is dishonest.

Saying "don't look" says that the Alioth shootout isn't worth the
server space it takes up. It's certainly not worth the amount of
pimping you do for it.

-austin

And you believe all that without even looking - truly remarkable!

(I suppose there are people who make judgements about Ruby without
looking.)
 
G

Gregory Brown

And you believe all that without even looking - truly remarkable!

(I suppose there are people who make judgements about Ruby without
looking.)

Can we avoid this shootout thing again. Anyone interested in the
history of this thread can find plenty on the archive, we don't need
to rehash it.

That having been said, comparing speed is a tough job. I'll
re-iterate the standard advice which seems to work to the OP. Try
just writing whatever you want in ruby first... then if you find
bottle necks, try to optimize them, and if you can't, C extensions are
always an option for the really computation heavy stuff. I'm not sure
i've seen anyone switch to perl or python because of speed, because
the gain is going to be something small if anything.

So... worry about performance when it becomes an issue. Or... if you
know how to optimize perl or python to make it sing, maybe go ahead
and use them. Otherwise, I'm pretty sure you'll find that speed
hangups can be avoided when needed in Ruby.
 
R

Robert Dober

------=_Part_20255_25604588.1144180637053
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Austin said:
Austin Ziegler wrote:
And you believe all that without even looking - truly remarkable!

(I suppose there are people who make judgements about Ruby without
looking.)


I understand that you are upset, but I *had* a look and I think I have
enough reason to consider the shootout irrelevant:
First, everybody can contribute ones program, like that, so what if I want
ruby to look bad, well easy enough, there comes one example into mind (c.f.
http://shootout.alioth.debian.org/debian/benchmark.php?test=3Dbinarytrees&l=
ang=3Druby),
the program does not even run.
Second I have often seen ruby1.9 being used, futile ( so I have my two
favorite words together "futile" and "irrelevant" ;)
to explain that 1.9 is not to be used for such a thing.
I checked a different program, sorry cannot give you the link, from the
shootout, it was written for slow performance period.
And last but not least, performance rarely matters and when it *really*
matters you need a change of magnitude.
And for that to accomplish you have to extend ruby in C or interface with C=
,
which is pretty easy compared to python or - even worse - perl.

So I honestly understand why Austin is upset although, I agree with you,
scientifcly speaking his attitude is wrong.
But I believe his conclusions are correct nontheless.

Cheers
Robert


--
Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.

- Albert Einstein

------=_Part_20255_25604588.1144180637053--
 
T

Tanner Burson

------=_Part_19431_10386275.1144181324253
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Austin said:
Austin Ziegler wrote:
And you believe all that without even looking - truly remarkable!

(I suppose there are people who make judgements about Ruby without
looking.)


I've looked at your site, nearly every time you've come in posting specific
benchmarks about something or other. I think its current incarnation is by
far the worst. You use certain performance and code characteristics, but
instead of quantifying the actual values in the comparisons (only in the
individual listings) you list them as, X is Y times better/worse than Z.
That tells me next to nothing. 1.1 times faster means very little at 10ms,
but quite a lot at 1hr. While I don't always agree with Austin's attitude
towards this subject, I do agree that the site is rarely useful, and often
causes people to mis-represent a given statistic.


--
=3D=3D=3DTanner Burson=3D=3D=3D
(e-mail address removed)
http://tannerburson.com <---Might even work one day...

------=_Part_19431_10386275.1144181324253--
 
I

Isaac Gouy

Robert said:
enough reason to consider the shootout irrelevant:
First, everybody can contribute ones program, like that, so what if I want
ruby to look bad, well easy enough,

Until someone who wants to make Ruby look good contributes a better
program ;-)

there comes one example into mind (c.f.
http://shootout.alioth.debian.org/debian/benchmark.php?test=binarytrees&lang=ruby),
the program does not even run.

Thank you, I can see that program has been measured with too short a
timeout.
The same program is shown here
http://shootout.alioth.debian.org/gp4/benchmark.php?test=binarytrees&lang=ruby&id=0

Second I have often seen ruby1.9 being used, futile ( so I have my two
favorite words together "futile" and "irrelevant" ;)
to explain that 1.9 is not to be used for such a thing.

The measurements on Gentoo : Intel are made for Ruby 1.8.4
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=ruby&lang2=ruby

I checked a different program, sorry cannot give you the link, from the
shootout, it was written for slow performance period.

Standard answer: contribute better programs.
 
I

Isaac Gouy

Tanner said:
I've looked at your site, nearly every time you've come in posting specific
benchmarks about something or other. I think its current incarnation is by
far the worst. You use certain performance and code characteristics, but
instead of quantifying the actual values in the comparisons (only in the
individual listings) you list them as, X is Y times better/worse than Z.
That tells me next to nothing. 1.1 times faster means very little at 10ms,
but quite a lot at 1hr.

On that page ( http://shootout.alioth.debian.org/gp4/ruby.php ) the
first paragraph includes a link to the "CPU time and Memory use
measurements"
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=ruby&lang2=ruby

While I don't always agree with Austin's attitude
towards this subject, I do agree that the site is rarely useful, and often
causes people to mis-represent a given statistic.

I also hear positive comments.
 
G

Gregory Brown

I also hear positive comments.

On ruby-talk?

Seriously, it's fine that you have this thing and maybe *someone*
finds it useful, but it doesn't seem well recieved on it's list and
the bottom line is it's not very useful for answering the OP's
question.

People have made their points loud and clear. Perhaps you should do
the kind thing and just let it go. If there is a community which
embraces your shootout, discuss it with them.
 
A

Austin Ziegler

T24gNC80LzA2LCBJc2FhYyBHb3V5IDxpZ291eUB5YWhvby5jb20+IHdyb3RlOgo+ID4gSSBjaGVj
a2VkIGEgZGlmZmVyZW50IHByb2dyYW0sIHNvcnJ5IGNhbm5vdCBnaXZlIHlvdSB0aGUgbGluaywg
ZnJvbSB0aGUKPiA+IHNob290b3V0LCBpdCB3YXMgd3JpdHRlbiBmb3Igc2xvdyBwZXJmb3JtYW5j
ZSBwZXJpb2QuCj4KPiBTdGFuZGFyZCBhbnN3ZXI6IGNvbnRyaWJ1dGUgYmV0dGVyIHByb2dyYW1z
LgoKU3RhbmRhcmQgYW5zd2VyOiBkb24ndCBwYXJ0aWNpcGF0ZSBpbiB0aGlzLiBUaGVyZSdzIG5v
dGhpbmcgaG9uZXN0CmFib3V0IGl0LCBhbmQgSXNhYWMgaXMgZXNzZW50aWFsbHkgbm8gYmV0dGVy
IHRoYW4gYSBzcGFtbWVyIHNpbmNlIGhpcwpwcmltYXJ5IGNvbnRyaWJ1dGlvbiB0byBydWJ5LXRh
bGsgaXMgdG8gcHJvbW90ZSB0aGlzIHNpdGUgd2hpY2gKcHJvdmlkZXMgbm8gdmFsdWUgdG8gYW55
b25lIGFuZCwgSU1PLCBwcm92aWRlcyBoYXJtIHRvIGFueW9uZSB3aG8KdGFrZXMgdGhlIHNpdGUg
c2VyaW91c2x5LgoKLWF1c3RpbgotLQpBdXN0aW4gWmllZ2xlciAqIGhhbG9zdGF0dWVAZ21haWwu
Y29tCiAgICAgICAgICAgICAgICogQWx0ZXJuYXRlOiBhdXN0aW5AaGFsb3N0YXR1ZS5jYQo=
 
C

Charles O Nutter

------=_Part_57698_7621691.1144205632938
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hey, if it makes y'all feel any better, Ruby is still worlds faster than
JRuby (though we're naturally working on that :)

--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ jruby.sourceforge.net
Application Architect @ www.ventera.com

------=_Part_57698_7621691.1144205632938--
 
N

Neil Wilson

Slower in what sense. It's certainly not slower to develop with than
either of its scripting colleagues and I find it easier to read.

The real question these days is is the language fast enough. You have
to remember that processor power is 50 to 100 cheaper than manpower. I
can afford to waste several days of processor time if I can save an
hour of manpower.
 
I

Isaac Gouy

Charles said:
Hey, if it makes y'all feel any better, Ruby is still worlds faster than
JRuby (though we're naturally working on that :)

(Depending what faster means) Rebol, and Rexx, and Groovy and... :)
 
I

Isaac Gouy

Austin said:
I understand that you are upset, but I *had* a look and I think I have
enough reason to consider the shootout irrelevant: First, everybody
can contribute ones program, like that, so what if I want ruby to look
bad, well easy enough, there comes one example into mind [...] the
program does not even run.

The better example is the Ackermann. On Unix, at least, the stack is
able to be reset with ulimit -- and the Ruby run of Ackermann does not
use this, even though Ruby's stack frame is known to be larger than most
other programming languages.

1) Ackermann is only shown on the "Old Doug Bagley Benchmarks" website

2) The Ruby run of Ackermann /does/ reset the stack with ulimit
http://shootout.alioth.debian.org/old/benchmark.php?test=ackermann&lang=all

3) The other websites do show simple recursive functions, including
ackermann, and the Ruby run /does/ reset the stack with ulimit
http://shootout.alioth.debian.org/gp4/benchmark.php?test=recursive&lang=all
The Python implementation does some stack manipulation without which the
program won't run *at all* (even with ulimit). One of the Perl
implementations is so compact as to be unreadable -- and it's done so
deliberately.

[...]
So I honestly understand why Austin is upset although, I agree with
you, scientifcly speaking his attitude is wrong. But I believe his
conclusions are correct nontheless.

Scientifically, my attitude toward the Alioth shootout is spot on. It's
not only benchmarking (lies, damned lies and [statistics | benchmarks]),
but it's completely dishonest benchmarking for the reasons that you've
indicated above, and (last I checked) the website claimed far more than
is possible, especially since there is no control factors or proper
statistical analysis.

-austin
 
I

Isaac Gouy

Gregory said:
On ruby-talk?

Commenting on ruby-talk would invite personal abuse.
Seriously, it's fine that you have this thing and maybe *someone*
finds it useful, but it doesn't seem well recieved on it's list and
the bottom line is it's not very useful for answering the OP's
question.

People have made their points loud and clear. Perhaps you should do
the kind thing and just let it go. If there is a community which
embraces your shootout, discuss it with them.

And when their points are demonstrably untrue, should we let it go?
 
I

Isaac Gouy

Robert said:
enough reason to consider the shootout irrelevant:
First, everybody can contribute ones program, like that, so what if I want
ruby to look bad, well easy enough, there comes one example into mind (c.f.
http://shootout.alioth.debian.org/debian/benchmark.php?test=binarytrees&lang=ruby),
the program does not even run.

The binary-trees program has been re-measured with the correct timeout
http://shootout.alioth.debian.org/debian/benchmark.php?test=binarytrees&lang=ruby&id=0
Second I have often seen ruby1.9 being used, futile ( so I have my two
favorite words together "futile" and "irrelevant" ;)
to explain that 1.9 is not to be used for such a thing.

ruby 1.8.4 (2005-12-24) [i486-linux] has been re-installed on Debian
: AMD™ Sempron™ and all the Ruby programs have been re-measured
http://shootout.alioth.debian.org/debian/ruby.php

If there are other problems please report them
http://shootout.alioth.debian.org/debian/faq.php#report
 
G

gregarican

sullivanz said:
This might be a stupid question, but I really wonder if ruby is much
slower than python and perl.

I know that I might be chiming in long after the fact on this thread,
but after awhile I get tired of the complaints regarding the speed of
Ruby. Not that the poster's original entry on this thread was
complaining, but others have posted complaints and in today's age of
rapid increases in RAM, HDD storage, CPU speed, etc. what's considered
slow is still pretty darn fast for most cases. It's kind of like the
long-standing knock of Java being slow. Starting up the JVM itself
takes awhile, but I recall back in the day around 1997 or so. That
thing could seem to take literally minutes to crank up on the old
hardware. Now it takes a couple of seconds in most cases.

There are many concepts involves in optimal computer programming. Code
elegance. Code readability. Code maintainability. Code execution speed.
Code brevity. These can sometimes be diametrically opposed.

I like Matz' explanations behind why he started to create Ruby. He
wanted a language that made him happy and that was enjoyable to program
in. He certainly didn't say what was bare-metal-fast to code in because
he wanted to win some shootout by running routine xyz in 1.2
milliseconds.

Most of the scripting languages take longer to execute things. But if I
was just looking for raw execution speed I'd stick with assembly or C.
I am looking for enjoyable, inuitive coding. That's why I like
languages like Ruby. Sure one can always refactor their code to make it
as clean and efficient as possible. But after a couple of iterations of
that if it's broke don't fix it IMHO :-/
 

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,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top