# Performance Ruby

**URL:** <https://rubytalk.org/t/performance-ruby/20084>\
**Category:** ruby-talk\
**Created:** [11 August 2005 11:41 UTC](https://rubytalk.org/t/performance-ruby/20084 "2005-08-11T11:41:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Goel](https://avatars.discourse-cdn.com/v4/letter/g/d9b06d/32.png) [@Goel](https://rubytalk.org/u/Goel)\
**Post date:** [11 August 2005 11:41 UTC](https://rubytalk.org/t/performance-ruby/20084/1 "2005-08-11T11:41:10Z")

</div>

Hi,

Is there any benchmark of the performance of Ruby vs. C, C++, Java etc?

I couln't find it on the ruby website.

Regards

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://rubytalk.org/u/Robert)\
**Post date:** [11 August 2005 11:46 UTC](https://rubytalk.org/t/performance-ruby/20084/2 "2005-08-11T11:46:11Z")

</div>

Goel wrote:

> Hi,
> 
> Is there any benchmark of the performance of Ruby vs. C, C++, Java  
> etc?
> 
> I couln't find it on the ruby website.
> 
> Regards

Yes, there are some public performance shootouts on the web. I'm sorry, I  
don't have a URL handy.

Kind regards

&nbsp;&nbsp;&nbsp;&nbsp;robert

---

<div class="post-metadata">

**Author:** ![Brian\_Schroder1](https://avatars.discourse-cdn.com/v4/letter/b/2bfe46/32.png) [@Brian\_Schroder1](https://rubytalk.org/u/Brian_Schroder1)\
**Post date:** [11 August 2005 11:50 UTC](https://rubytalk.org/t/performance-ruby/20084/3 "2005-08-11T11:50:24Z")

</div>

You could start reading with this thread

[http://groups-beta.google.com/group/comp.lang.ruby/browse\_frm/thread/b4232ad4e01ed3ef/fd98604d40d7a6f3?lnk=st&q=benchmark+comp.lang.ruby&rnum=23&hl=en#fd98604d40d7a6f3](http://groups-beta.google.com/group/comp.lang.ruby/browse_frm/thread/b4232ad4e01ed3ef/fd98604d40d7a6f3?lnk=st&q=benchmark+comp.lang.ruby&rnum=23&hl=en#fd98604d40d7a6f3)

theres a lot about this in the archives. It boils down to ten simple  
commandments and one addition:

1.) Optimize only when it is really too slow.  
2.) Only optimize if it is too slow  
3.) Only optimize if it is too slow  
4.) Only optimize if it is too slow  
5.) Only optimize if it is too slow  
6.) Optimize first by using a better algorithm.  
7.) Only optimize if it is too slow  
8.) If it really really is too slow rewrite the slow parts in C.  
9.) Only optimize if it is too slow  
10.) Only optimize if it is too slow

((11)) A lot of people think that the Alioth Benchmarks are crap.

regards,

Brian

> **···**
>
> On 11/08/05, Goel \<spam@microsoft.com\> wrote:
> 
> > Hi,
> > 
> > Is there any benchmark of the performance of Ruby vs. C, C++, Java etc?
> > 
> > I couln't find it on the ruby website.
> > 
> > Regards
> 
> --  
> [http://ruby.brian-schroeder.de/](http://ruby.brian-schroeder.de/)
> 
> Stringed instrument chords: [http://chordlist.brian-schroeder.de/](http://chordlist.brian-schroeder.de/)

---

<div class="post-metadata">

**Author:** ![Lothar\_Scholz2](https://avatars.discourse-cdn.com/v4/letter/l/f14d63/32.png) [@Lothar\_Scholz2](https://rubytalk.org/u/Lothar_Scholz2)\
**Post date:** [11 August 2005 11:58 UTC](https://rubytalk.org/t/performance-ruby/20084/4 "2005-08-11T11:58:37Z")

</div>

Hello Goel,

> Hi,

> Is there any benchmark of the performance of Ruby vs. C, C++, Java etc?

This makes no sense at all.  
Ruby in another kind of tool then C,C++,Java.

If you want compare it with other languages then compare it with  
Python,Perl or TCL.

If you don't understand why you can't compare it with a static typed  
compiled language start writing programs in ruby for one month and  
then think again.

> **···**
>
> --  
> Best regards, emailto: scholz at scriptolutions dot com  
> Lothar Scholz [http://www.ruby-ide.com](http://www.ruby-ide.com)  
> CTO Scriptolutions Ruby, PHP, Python IDE 's

---

<div class="post-metadata">

**Author:** ![mathew](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@mathew](https://rubytalk.org/u/mathew)\
**Post date:** [11 August 2005 19:56 UTC](https://rubytalk.org/t/performance-ruby/20084/5 "2005-08-11T19:56:10Z")

</div>

Goel wrote:

> Is there any benchmark of the performance of Ruby vs. C, C++, Java etc?
> 
> I couln't find it on the ruby website.

There's the Great Computer Language Shootout.  
\<URL:[http://shootout.alioth.debian.org/&gt](http://shootout.alioth.debian.org/&gt);

However, remember that the single biggest factor in performance is the algorithm, not the language you choose to implement it in. It's not uncommon to move or change one line of code and suddenly quadruple the performance. Also, the best algorithm in language X may be very sub-optimal in language Y, so comparison of line-for-line translations of code is inherently flawed.

For example, Scheme is guaranteed to be properly tail-recursive, so a recursive algorithm can be implemented very efficiently. Try the same algorithm in (say) Visual Basic, and it'll perform dreadfully.

mathew

> **···**
>
> --  
> \<URL:[http://www.pobox.com/~meta/&gt](http://www.pobox.com/~meta/&gt);  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WE HAVE TACOS

---

<div class="post-metadata">

**Author:** ![Goel](https://avatars.discourse-cdn.com/v4/letter/g/d9b06d/32.png) [@Goel](https://rubytalk.org/u/Goel)\
**Post date:** [11 August 2005 12:16 UTC](https://rubytalk.org/t/performance-ruby/20084/6 "2005-08-11T12:16:10Z")

</div>

I'm sorry, but my knowledge is not that deep.

I'm still from the 'old' Pascal school, learned some Java, understand OO and  
the concept is very logic, however Java itself is for me 'too strange'.  
When I saw some written code in Ruby, I immediately knew this was my  
language, since the writing and logic is my naturally (for me at least).

A friend is thinking to use it at his work too (standalone), but must know  
some things about the performance before he is going to use it; hence my  
(wrong) question.

Regards, Goel

"Lothar Scholz" \<mailinglists@scriptolutions.com\> schreef in bericht  
news:10436390218.20050811185827@scriptolutions.com...

> **···**
>
> > Hello Goel,
> > 
> > \> Hi,
> > 
> > \> Is there any benchmark of the performance of Ruby vs. C, C++, Java etc?
> > 
> > This makes no sense at all.  
> > Ruby in another kind of tool then C,C++,Java.
> > 
> > If you want compare it with other languages then compare it with  
> > Python,Perl or TCL.
> > 
> > If you don't understand why you can't compare it with a static typed  
> > compiled language start writing programs in ruby for one month and  
> > then think again.
> > 
> > --  
> > Best regards, emailto: scholz at scriptolutions dot  
> > com  
> > Lothar Scholz [http://www.ruby-ide.com](http://www.ruby-ide.com)  
> > CTO Scriptolutions Ruby, PHP, Python IDE 's

---

<div class="post-metadata">

**Author:** ![Austin\_Ziegler5](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/austin_ziegler5/32/1985_2.png) [@Austin\_Ziegler5](https://rubytalk.org/u/Austin_Ziegler5)\
**Post date:** [12 August 2005 13:56 UTC](https://rubytalk.org/t/performance-ruby/20084/7 "2005-08-12T13:56:30Z")

</div>

Which, as I keep reminding people, isn't worth the paper it isn't  
printed on. It's a waste of time, effort, and credibility to keep  
promoting it as if the people who created it know what they're doing.

Not all benchmarks are bad, but the GCLS is the least useful.

-austin

> **···**
>
> On 8/11/05, mathew \<meta@pobox.com\> wrote:
> 
> > Goel wrote:  
> > \> Is there any benchmark of the performance of Ruby vs. C, C++, Java etc?  
> > \>  
> > \> I couln't find it on the ruby website.  
> > There's the Great Computer Language Shootout.  
> > \<URL:[http://shootout.alioth.debian.org/&gt](http://shootout.alioth.debian.org/&gt);
> 
> --  
> Austin Ziegler \* halostatue@gmail.com  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\* Alternate: austin@halostatue.ca

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://rubytalk.org/u/Robert)\
**Post date:** [11 August 2005 12:21 UTC](https://rubytalk.org/t/performance-ruby/20084/8 "2005-08-11T12:21:10Z")

</div>

Goel wrote:

> I'm sorry, but my knowledge is not that deep.
> 
> I'm still from the 'old' Pascal school, learned some Java, understand  
> OO and the concept is very logic, however Java itself is for me 'too  
> strange'. When I saw some written code in Ruby, I immediately knew  
> this was my language, since the writing and logic is my naturally  
> (for me at least).
> 
> A friend is thinking to use it at his work too (standalone), but must  
> know some things about the performance before he is going to use it;  
> hence my (wrong) question.

Performance is not everything. Maybe it helps to know which kinds of  
problems your friend is going to solve with the language he chooses.

Kind regards

&nbsp;&nbsp;&nbsp;&nbsp;robert

---

<div class="post-metadata">

**Author:** ![Lothar\_Scholz2](https://avatars.discourse-cdn.com/v4/letter/l/f14d63/32.png) [@Lothar\_Scholz2](https://rubytalk.org/u/Lothar_Scholz2)\
**Post date:** [11 August 2005 14:32 UTC](https://rubytalk.org/t/performance-ruby/20084/9 "2005-08-11T14:32:12Z")

</div>

Hello Goel,

> A friend is thinking to use it at his work too (standalone), but must know  
> some things about the performance before he is going to use it; hence my  
> (wrong) question.

So the answer is it maybe 200 times slower (for example a pure ruby  
implementation of zip/gzip) or it might be only 5 times slower as C  
when you call a lot of C buildin's or a C library wrapper.

Does this really help ? I guess not.

> **···**
>
> --  
> Best regards, emailto: scholz at scriptolutions dot com  
> Lothar Scholz [http://www.ruby-ide.com](http://www.ruby-ide.com)  
> CTO Scriptolutions Ruby, PHP, Python IDE 's

---

<div class="post-metadata">

**Author:** ![Mark\_Probert](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@Mark\_Probert](https://rubytalk.org/u/Mark_Probert)\
**Post date:** [11 August 2005 21:19 UTC](https://rubytalk.org/t/performance-ruby/20084/10 "2005-08-11T21:19:51Z")

</div>

Hi ..

> A friend is thinking to use it at his work too (standalone), but must know  
> some things about the performance before he is going to use it; hence my  
> (wrong) question.

Perceived performance is a strange issue.

My experience has been that Ruby is "fast enough" for all that I want it  
to do, including some fairly complex data collection and processing.  
Any issues that I have had aren't with its "performance".

Now, if pure speed is what your friend is after, then it is going to  
depend on the problem domain and finding the right tool for the job.  
Though the real answer is going to lie in some compromise between  
developer performance and system performance.

For example, J (www.jsoftware.com) is wonderful, fast, extra-ordinary in  
its domain. Nothing can touch it, really. And the learning curve is  
almost perpendicular. I have often wanted to us it in anger and could  
not justify it. On the other hand, I can and do use Forth. Ruby won't  
work there 😉 and I find it better than C.

So, the short answer is get your friend to try out Ruby. Post to clr if  
there are problems and see for himself. If ruby is too slow, try  
Python. Or OCaml. Or Nice.

Regards,

> **···**
>
> On Thu, 2005-08-11 at 21:16 +0900, Goel wrote:
> 
> --  
> -mark. (probertm at acm dot org)

---

<div class="post-metadata">

**Author:** ![BearItAll](https://avatars.discourse-cdn.com/v4/letter/b/958977/32.png) [@BearItAll](https://rubytalk.org/u/BearItAll)\
**Post date:** [12 August 2005 08:11 UTC](https://rubytalk.org/t/performance-ruby/20084/11 "2005-08-12T08:11:11Z")

</div>

When I first tried Ruby, my main software language was c++ and main script  
language was perl or python. I decided that despite it being incredibly  
easy to learn, Ruby was just too slow for the script project I was doing  
at the time, which was a replacement for my server mirror software. The  
speed of traversing through the directories increased my over night mirror  
by a very long time (no point in saying how long because it obviously  
depends on how many files are involved, but it was a great deal longer  
than the previous version written in C++).

But I have since sort of slipped into using Ruby for just about all of my  
scripting in such a way that I hardly noticed until I wrote this post,  
that I haven't actually written in python since xmas. All those small two  
minute jobs that you tend to need a lot, such as find routines and  
maintenance tasks, are written in moments using Ruby.

I still find some areas of Ruby very confusing, compared to c++, but that  
is more because I was C++ only so such a long time that I would of found  
difficulty with any language.

Ruby rails is to me the biggee though. When it comes to web type work I  
have always had a blind spot. I hated html from the day I first saw it,  
and we've never got on since. So anything that can help me write a  
web site without too much html involved is a good thing. It is a struggle  
at the moment to find hosts for it, in fact I haven't found one yet, but  
it is such a good web development environment that I am sure it will pick  
up steam.

> **···**
>
> On Thu, 11 Aug 2005 14:12:47 +0200, Goel wrote:
> 
> > I'm sorry, but my knowledge is not that deep.
> > 
> > I'm still from the 'old' Pascal school, learned some Java, understand OO and  
> > the concept is very logic, however Java itself is for me 'too strange'.  
> > When I saw some written code in Ruby, I immediately knew this was my  
> > language, since the writing and logic is my naturally (for me at least).
> > 
> > A friend is thinking to use it at his work too (standalone), but must know  
> > some things about the performance before he is going to use it; hence my  
> > (wrong) question.

---

<div class="post-metadata">

**Author:** ![Brian\_Wisti](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@Brian\_Wisti](https://rubytalk.org/u/Brian_Wisti)\
**Post date:** [12 August 2005 22:30 UTC](https://rubytalk.org/t/performance-ruby/20084/12 "2005-08-12T22:30:46Z")

</div>

I always had the impression that the GCLS was presented as "purely for  
entertainment purposes only," and people who take them too seriously  
were to be scoffed at by sane people everywhere as well as the  
founders of the project.

That's just my perception, but this is one of the few cases where I  
don't really care whether or my perception is correct.

Kind Regards,

Brian Wisti  
[http://coolnamehere.com/](http://coolnamehere.com/)

> **···**
>
> On 8/12/05, Austin Ziegler \<halostatue@gmail.com\> wrote:
> 
> > On 8/11/05, mathew \<meta@pobox.com\> wrote:  
> > \> Goel wrote:  
> > \> \> Is there any benchmark of the performance of Ruby vs. C, C++, Java etc?  
> > \> \>  
> > \> \> I couln't find it on the ruby website.  
> > \> There's the Great Computer Language Shootout.  
> > \> \<URL:[http://shootout.alioth.debian.org/&gt](http://shootout.alioth.debian.org/&gt);
> > 
> > Which, as I keep reminding people, isn't worth the paper it isn't  
> > printed on. It's a waste of time, effort, and credibility to keep  
> > promoting it as if the people who created it know what they're doing.
> > 
> > Not all benchmarks are bad, but the GCLS is the least useful.

---

<div class="post-metadata">

**Author:** ![Gene\_Tani](https://avatars.discourse-cdn.com/v4/letter/g/4491bb/32.png) [@Gene\_Tani](https://rubytalk.org/u/Gene_Tani)\
**Post date:** [11 August 2005 12:46 UTC](https://rubytalk.org/t/performance-ruby/20084/13 "2005-08-11T12:46:10Z")

</div>

Robert K is correct. Some observes:

- many apps are bound by external constraints: your DB / web / FTP /  
NFS server only runs so fast, i.e. C++ apps may be 0.3% faster in this  
case.

- the development cycle in ruby is different from C/JAva. There isn't  
compile-time checking the way a C++ /java programmer thinks about it.  
You have to set up a meaningful Exception hierarchy and unit-test  
extensively.

- after you profile a ruby app, you can choose to re-code part or all  
of bottlenecks in C (rubyInline, ruby2C, maybe other tools out there)

---

<div class="post-metadata">

**Author:** ![Jeff\_Wood](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@Jeff\_Wood](https://rubytalk.org/u/Jeff_Wood)\
**Post date:** [11 August 2005 16:04 UTC](https://rubytalk.org/t/performance-ruby/20084/14 "2005-08-11T16:04:31Z")

</div>

There is an online comparison of MANY computer languages ...

[http://shootout.alioth.debian.org/](http://shootout.alioth.debian.org/)

... there are some programs that don't seem to have any ruby solution  
yet... if any of you feel up to it, ( or if you want to look at the  
existing solutions that are there and performance tweak them ) ... It  
would be a "good thing"

Anyways, I hope that provides the informatoin that the original post  
was looking for.

j.

> **···**
>
> On 8/11/05, Lothar Scholz \<mailinglists@scriptolutions.com\> wrote:
> 
> > Hello Goel,
> > 
> > \> A friend is thinking to use it at his work too (standalone), but must know  
> > \> some things about the performance before he is going to use it; hence my  
> > \> (wrong) question.
> > 
> > So the answer is it maybe 200 times slower (for example a pure ruby  
> > implementation of zip/gzip) or it might be only 5 times slower as C  
> > when you call a lot of C buildin's or a C library wrapper.
> > 
> > Does this really help ? I guess not.
> > 
> > --  
> > Best regards, emailto: scholz at scriptolutions dot com  
> > Lothar Scholz [http://www.ruby-ide.com](http://www.ruby-ide.com)  
> > CTO Scriptolutions Ruby, PHP, Python IDE 's
> 
> --  
> "So long, and thanks for all the fish"
> 
> Jeff Wood

---

<div class="post-metadata">

**Author:** ![Austin\_Ziegler5](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/austin_ziegler5/32/1985_2.png) [@Austin\_Ziegler5](https://rubytalk.org/u/Austin_Ziegler5)\
**Post date:** [12 August 2005 23:11 UTC](https://rubytalk.org/t/performance-ruby/20084/15 "2005-08-12T23:11:29Z")

</div>

Okay, to be completely fair: yes, the GCLS is presented as "purely for  
entertainment purposes only." At least that's what is said on the GCLS  
website, which makes it the operating theory, at least.

In practice, though, the Alioth shootout is heavily promoted by the  
people what run it and others, and there are comparisons between  
different languages and little is done to make sure that the various  
languages don't cheat (I found a cheat in the Perl implementation of the  
Ackermann and a sort-of-cheat in the Python implementation). There's a  
whole veneer of respectability about this particular set of tests,  
complete with the encouragement to "make your language perform better."  
In other words, for something that's "for entertainment purposes only,"  
there's a lot of time spent making it look "legitimate."

When the people who run it are confronted with this, they fall back on  
the "it's not serious" line ... while very shortly after doing something  
that suggests that it is, indeed, serious.

The Alioth shootout is dishonest in its presentation and purpose. It  
does \*more\* than place "performance" numbers on the screen; it offers an  
interpretation of those numbers ... all the while pretending not to  
offer said interpretation.

Real world performance numbers are more useful, and when Ara Howard  
tells me that Ruby performs fast enough for his image crunching, or Rich  
Kilmer tells me that Ruby made Cougaar possible and fast, then I believe  
them. These people (and others) are pushing Ruby further than anyone  
else, including people who use Ruby on Rails. And yet, I also believe  
DHH when he says that Rails scalability isn't a big issue, in that it  
scales the same way that web applications have scaled for a while, and  
the same way that Kuro5hin and Slashdot scaled -- more machines with  
load balancing and separating the database server from the application  
server.

If you want to see an \*intense\* Ruby application, look at my own  
PDF::Writer. The layout engine is about as computationally intensive as  
one will get in pure Ruby, and would merit dropping to C in some places  
(except that I have deliberately made it a goal to keep the code pure  
Ruby). On my VERY SLOW LAPTOP, it takes no more than ten minutes to  
generate the 90+ page manual. It takes a matter of seconds to generate  
each demo (and most of \*that\* is in the startup).

On my 3Ghz work machine, it's about 2 1/2 - 3 minutes to do the same  
manual. I suspect that with the report generator that's being talked  
about, there will be some time involved with the PDF generation for  
output, but it will still be fast enough to be usable from Rails.

I'm getting ready to add SVG support to PDF::Writer, and my current code  
is whipping through complex SVGs pretty quickly. For some things, it  
takes enough processing time that I'll recommend people do partial  
rendering beforehand -- which is a good idea in any case for many  
things and not just for performance reasons. I'll be documenting the  
technique, too.

I'm not saying anything new here, not really.

-austin

> **···**
>
> On 8/12/05, Brian Wisti \<brian.wisti@gmail.com\> wrote:
> 
> > On 8/12/05, Austin Ziegler \<halostatue@gmail.com\> wrote:
> > 
> > > On 8/11/05, mathew \<meta@pobox.com\> wrote:
> > > 
> > > > Goel wrote:
> > > > 
> > > > > Is there any benchmark of the performance of Ruby vs. C, C++, Java  
> > > > > etc?  
> > > > > I couln't find it on the ruby website.
> > > > 
> > > > There's the Great Computer Language Shootout.  
> > > > \<URL:[http://shootout.alioth.debian.org/&gt](http://shootout.alioth.debian.org/&gt);
> > > 
> > > Which, as I keep reminding people, isn't worth the paper it isn't  
> > > printed on. It's a waste of time, effort, and credibility to keep  
> > > promoting it as if the people who created it know what they're doing.
> > > 
> > > Not all benchmarks are bad, but the GCLS is the least useful.
> > 
> > I always had the impression that the GCLS was presented as "purely for  
> > entertainment purposes only," and people who take them too seriously  
> > were to be scoffed at by sane people everywhere as well as the  
> > founders of the project.
> > 
> > That's just my perception, but this is one of the few cases where I  
> > don't really care whether or my perception is correct.
> 
> --  
> Austin Ziegler \* halostatue@gmail.com  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\* Alternate: austin@halostatue.ca

---

<div class="post-metadata">

**Author:** ![Gerardo\_Santana\_Gome](https://avatars.discourse-cdn.com/v4/letter/g/b5ac83/32.png) [@Gerardo\_Santana\_Gome](https://rubytalk.org/u/Gerardo_Santana_Gome)\
**Post date:** [13 August 2005 05:30 UTC](https://rubytalk.org/t/performance-ruby/20084/16 "2005-08-13T05:30:19Z")

</div>

Here's one:  
[http://www.codefusionis.com/index.php?page=hosting](http://www.codefusionis.com/index.php?page=hosting)

right on top of the so called most secure Unix-like OS.

> **···**
>
> On 8/12/05, BearItAll \<bearitall@rassler.co.uk\> wrote:
> 
> > On Thu, 11 Aug 2005 14:12:47 +0200, Goel wrote:
> > 
> > \> I'm sorry, but my knowledge is not that deep.  
> > \>  
> > \> I'm still from the 'old' Pascal school, learned some Java, understand OO and  
> > \> the concept is very logic, however Java itself is for me 'too strange'.  
> > \> When I saw some written code in Ruby, I immediately knew this was my  
> > \> language, since the writing and logic is my naturally (for me at least).  
> > \>  
> > \> A friend is thinking to use it at his work too (standalone), but must know  
> > \> some things about the performance before he is going to use it; hence my  
> > \> (wrong) question.  
> > \>
> > 
> > When I first tried Ruby, my main software language was c++ and main script  
> > language was perl or python. I decided that despite it being incredibly  
> > easy to learn, Ruby was just too slow for the script project I was doing  
> > at the time, which was a replacement for my server mirror software. The  
> > speed of traversing through the directories increased my over night mirror  
> > by a very long time (no point in saying how long because it obviously  
> > depends on how many files are involved, but it was a great deal longer  
> > than the previous version written in C++).
> > 
> > But I have since sort of slipped into using Ruby for just about all of my  
> > scripting in such a way that I hardly noticed until I wrote this post,  
> > that I haven't actually written in python since xmas. All those small two  
> > minute jobs that you tend to need a lot, such as find routines and  
> > maintenance tasks, are written in moments using Ruby.
> > 
> > I still find some areas of Ruby very confusing, compared to c++, but that  
> > is more because I was C++ only so such a long time that I would of found  
> > difficulty with any language.
> > 
> > Ruby rails is to me the biggee though. When it comes to web type work I  
> > have always had a blind spot. I hated html from the day I first saw it,  
> > and we've never got on since. So anything that can help me write a  
> > web site without too much html involved is a good thing. It is a struggle  
> > at the moment to find hosts for it, in fact I haven't found one yet
> 
> --  
> Gerardo Santana Gómez Garrido
> 
> > **[openbsd.org.mx](http://www.openbsd.org.mx/santana/)**
> >
> > This domain may be for sale!
> 
> "Entre los individuos, como entre las naciones, el respeto al derecho  
> ajeno es la paz" -Don Benito Juárez

---

<div class="post-metadata">

**Author:** ![Marek\_Kubica](https://avatars.discourse-cdn.com/v4/letter/m/b5a626/32.png) [@Marek\_Kubica](https://rubytalk.org/u/Marek_Kubica)\
**Post date:** [11 August 2005 16:16 UTC](https://rubytalk.org/t/performance-ruby/20084/17 "2005-08-11T16:16:11Z")

</div>

Hello!

> **···**
>
> On Fri, 12 Aug 2005 01:04:31 +0900 Jeff Wood wrote:
> 
> > There is an online comparison of MANY computer languages ...
> > 
> > [http://shootout.alioth.debian.org/](http://shootout.alioth.debian.org/)
> > 
> > .. there are some programs that don't seem to have any ruby solution  
> > yet... if any of you feel up to it, ( or if you want to look at the  
> > existing solutions that are there and performance tweak them ) ... It  
> > would be a "good thing"
> 
> Heres another version of that shootout  
> [http://dada.perl.it/shootout/](http://dada.perl.it/shootout/)
> 
> Brian Schröder put it imho right:  
> "Only optimize if it is too slow"
> 
> greets,  
> Marek

---

<div class="post-metadata">

**Author:** ![Austin\_Ziegler5](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/austin_ziegler5/32/1985_2.png) [@Austin\_Ziegler5](https://rubytalk.org/u/Austin_Ziegler5)\
**Post date:** [11 August 2005 16:42 UTC](https://rubytalk.org/t/performance-ruby/20084/18 "2005-08-11T16:42:24Z")

</div>

The best option for this shootout is to NOT implement anything for it.

The people running it don't know the first thing about what they're  
doing and won't take responsibility for the errors in methodology and  
the fact that their presentation encourages bad interpretation. The  
Alioth shootout is dishonest to its core.

-austin

> **···**
>
> On 8/11/05, Jeff Wood \<jeff.darklight@gmail.com\> wrote:
> 
> > There is an online comparison of MANY computer languages ...
> > 
> > [http://shootout.alioth.debian.org/](http://shootout.alioth.debian.org/)
> > 
> > ... there are some programs that don't seem to have any ruby solution  
> > yet... if any of you feel up to it, ( or if you want to look at the  
> > existing solutions that are there and performance tweak them ) ... It  
> > would be a "good thing"
> > 
> > Anyways, I hope that provides the informatoin that the original post  
> > was looking for.
> 
> --  
> Austin Ziegler \* halostatue@gmail.com  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\* Alternate: austin@halostatue.ca

---

<div class="post-metadata">

**Author:** ![Ara.T.Howard6](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Ara.T.Howard6](https://rubytalk.org/u/Ara.T.Howard6)\
**Post date:** [13 August 2005 00:16 UTC](https://rubytalk.org/t/performance-ruby/20084/19 "2005-08-13T00:16:33Z")

</div>

\<snip\>

here's some food for thought:

the other day my co-worker was out in dc. one of our clients wanted to gain a  
better understanding of one of our products. the product in question is a  
'fires' product that we make using nighttime lights of the world, some temp  
info, etc. to show where nighttime fires are. the fires are placed into a  
geographic grid - an image where each pixel maps to a lat/lon. the images are  
quite simple and all meta info is in a .hdr file (this is envi's file format).  
in any case placing fires in a grid leaves some empty grid cells since the  
grid is of coarser resolution than the data. we fill this grid in using  
nearest-neighbor. the client wanted to no which pixels were 'nubs' or centers  
- which ones were actual pixels and not a product of filling. it turns out we  
track this info, along with 15 bits of other stuff, in a 'flag' image - it's  
simply an image of pixels where each pixel is a bitmask marking certain  
attributes of each pixel as true or false such as 'cloudy' and the like.

so i needed to make a 'fire center' image - it would be just like a fire image  
but contain only 'nubs' or centers. this is an easy thing to do since all i  
had to do was copy the fires image and set everything to background that was  
NOT a nub and was not no data (missing pixels). here's a sample run:

&nbsp;&nbsp;&nbsp;jib:~/eg/ruby/fires2firecenters/fires2firecenters-0.0.0 \> time fires2firecenters F1420050720.0.fires

&nbsp;&nbsp;&nbsp;real 0m9.931s  
&nbsp;&nbsp;&nbsp;user 0m2.240s  
&nbsp;&nbsp;&nbsp;sys 0m4.580s

o.k. ten seconds. but what does that mean?

&nbsp;&nbsp;&nbsp;jib:~/eg/ruby/fires2firecenters/fires2firecenters-0.0.0 \> ls -ltarh  
&nbsp;&nbsp;&nbsp;F1420050720.0.fires F1420050720.0.flag F1420050720.0.fires.centers  
&nbsp;&nbsp;&nbsp;-rw-rw-r-- 1 ahoward ahoward 102M Aug 12 17:42 F1420050720.0.fires  
&nbsp;&nbsp;&nbsp;-rw-rw-r-- 1 ahoward ahoward 204M Aug 12 17:43 F1420050720.0.flag  
&nbsp;&nbsp;&nbsp;-rw-rw-r-- 1 ahoward ahoward 102M Aug 12 17:44 F1420050720.0.fires.centers

so you can see both input images (fires, flag) are 100/200 mb respectively and  
the output is 100 mb. so that's 300mb of io - at least. i didn't even bother  
to profile the code because i was super busy that day and it was fast enough.  
the really good part, however, is the code:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/env ruby  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;require 'narray'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;require 'fileutils'

> **···**
>
> On Sat, 13 Aug 2005, Austin Ziegler wrote:
> 
> > Real world performance numbers are more useful, and when Ara Howard tells me  
> > that Ruby performs fast enough for his image crunching, or Rich Kilmer tells  
> > me that Ruby made Cougaar possible and fast, then I believe them. These  
> > people (and others) are pushing Ruby further than anyone else, including  
> > people who use Ruby on Rails. And yet, I also believe DHH when he says that  
> > Rails scalability isn't a big issue, in that it scales the same way that web  
> > applications have scaled for a while, and the same way that Kuro5hin and  
> > Slashdot scaled -- more machines with load balancing and separating the  
> > database server from the application server.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# parse command line - setup  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fires\_grid, flag\_grid, fire\_centers\_grid = ARGV
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unless fires\_grid  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;STDERR.puts "#{ File::basename $0 } fires\_grid [flag\_grid] [fire\_centers\_grid]"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit 1  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flag\_grid ||= fires\_grid.gsub( %r/fires$/, 'flag' )  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fire\_centers\_grid ||= fires\_grid.gsub( %r/fires$/, 'fires.centers' )
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;center\_mask = 2 \*\* (center\_bit = 4)  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;no\_data\_mask = 2 \*\* (no\_data\_bit = 15)  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# load files  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fires = NArray::to\_na( IO::read( fires\_grid ), NArray::BYTE )  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flags = NArray::to\_na( IO::read( flag\_grid ), NArray::SINT )  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# zero out anything that's neither center nor no\_data  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fire\_centers = fires  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is\_data = ( flags & no\_data\_mask ).not  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is\_not\_center = ( flags & center\_mask ).not  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fire\_centers[is\_not\_center.and( is\_data )] = 0  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# write centers output  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;open(fire\_centers\_grid, 'wb'){|f| f.write fire\_centers.to\_s}  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# copy .fires hdr to .fires.centers.hdr  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FileUtils::cp "#{ fires\_grid }.hdr", "#{ fire\_centers\_grid }.hdr"
> 
> it's a hack, it uses extensions, and it took me 5 minutes to write and ran  
> perfectly the first time. i love it.
> 
> cheers.
> 
> # -a --
> 
> > email :: ara [dot] t [dot] howard [at] noaa [dot] gov  
> > phone :: 303.497.6469  
> > Your life dwells amoung the causes of death Like a lamp standing in a strong breeze. --Nagarjuna
> 
> ===============================================================================

---

<div class="post-metadata">

**Author:** ![Stefan\_Schmiedl](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Stefan\_Schmiedl](https://rubytalk.org/u/Stefan_Schmiedl)\
**Post date:** [13 August 2005 06:51 UTC](https://rubytalk.org/t/performance-ruby/20084/20 "2005-08-13T06:51:12Z")

</div>

If I'm into programming mood on the few days I'm not busy programming,  
I try my hand at coding shootout tasks. Then I try to learn from the  
differences between my solution and the one published on the site.

I'm not much of a shootout person myself.

s.

> **···**
>
> On Sat, 13 Aug 2005 08:11:29 +0900, Austin Ziegler \<halostatue@gmail.com\> wrote:
> 
> > Okay, to be completely fair: yes, the GCLS is presented as "purely for  
> > entertainment purposes only." At least that's what is said on the GCLS  
> > website, which makes it the operating theory, at least.

[Next page](https://rubytalk.org/t/performance-ruby/20084.md?page=2)
