Paris Sinclair ha scritto:
> On Mon, 24 Jan 2005, Premshree Pillai wrote:
> 
>>>> You can find some standard benchmarks at 
>>>> http://shootout.alioth.debian.org/
>>>
>>>
>>> the requirements are that each language implement the sollution 
>>> exactly the
>>> same as some other language implementation that was already done.
>>
>>
>> Umm, what makes you think the implementations are done differently for
>> different languages? They use a standard algorithm -- for obvious
>> reasons -- across all the languages.
> 
> 
> Yes, normally when you are benchmarking and comparing language, you 
> start with a problem and what the end result of the solution should be. 
> And then of course the exact implementation in each language will be 
> appropriate to that language. For example, sorting in C often looks very 
> different from sorting in Perl. THe lowest common denominator will be 
> C-ish. And Ruby's ranges are another example. In these benchmarks, the 
> format forces the Ruby code to look like C.
>     for i in 0 .. (rows - 1)
> instead of
>     (0...rows).each { |i| ... }
> I don't know in this case if there is a difference in performance. I a 
> nuby. BUt I know that in Perl, the Perl-ish constructs are the ones best 
> optimized. If you structure your code the same as a Java app, it will go 
> sloooow. Even at tasks like sorting, where the opposite is usually true 
> in real life. You wouldn't hand-code a quicksort, because the included 
> one is lightning speed.

well, this example is not correct (since, for example, there are some 
scripts that use Integer#times instead of for).
But in general, we'd never write a dumb generate_random() method instead 
of using the builtin #rand, just to say :)