From: "William James" <w_a_x_man / yahoo.com>
> Alexis Reigel wrote:
>> Stephen Waits wrote:
>> > E. Saynatkari wrote:
>> >
>> >>
>> >> Post the code somewhere, there might be room for improvement
>> >> in the algorithm though it will still be considerably slower.
>> >
>> >
>> > It looks, to me, like he attached his code to the OP.
>> >
>> > Regardless, it doesn't matter.  Algorithmic improvements may help both
>> > the C++ and Ruby versions - but it's not going to change the fact that
>> > one is a relatively low-level language, compiled to native machine code,
>> > and the other is an interpreted dynamic language.  To compare them is
>> > either ridiculous, or more likely in this case, simply ignorant.
>> >
>> > --Steve
>> >
>> Why should that be ridiculous or ignorant?
>> I stated that I was aware of the differences between interpreted and
>> compiled languages. But that does not change the fact that I believe
>> that this does not explain the performance gap. An execution time of
>> 27.65 seconds against 0.33 seconds is not just nothing is it? It's a
>> factor of over 80 times. Besides, I implemented the same code in java
>> too, which isn't native code
> 
> More ignorance.  Java has a JIT compiler which produces
> machine code.

Alexis,

This is usually a friendly community, by the way.    :rolleyes:

But yes, it's harder to make a language like Ruby, which is highly
dynamic at runtime, fast like C++ and Java, which are primarily 
statically compiled.  The Smalltalk folks have reportedly done pretty
well though, so there exists the possiblilty that Ruby may get
substantially faster in the future.  YARV is already making some
headway.

Regards,

Bill