That's true, but this example is meaningless anyway. The point is that 
if you find more than a couple of places in your application where Ruby 
does not provide an acceptable performance, you probably should use 
another language for the task. I just wanted to demonstrate that with 
the help of RubyInline or even Ruby2C you can translate these 
bottleneck spots without much of the hassle.

Cheers,
Kent.

On Feb 6, 2005, at 1:14 AM, Alexander Staubo wrote:

> Kent Sibilev wrote:
>> Consider this 'tuning':
> [snip]
>> class Test
>>   def run
>>     d=0
>>     1000000000.downto(1) {
>>       d = d + 1
>>     }
> [snip]
>>     double d = 0;
>>     for (int i = 0; i < 1000000000; i++) {
>>       d = d + i;
>>     }
>
> To be fair, the type of the variable in the Mono example is "double", 
> but the Ruby example uses an int. A more appropriate Ruby version:
>
>   def run
>     d = 0.0
>     1000000000.downto(1) {
>       d = d + 1.0
>     }
>     return d
>   end
>
> Alexander.
>