At 12:49 PM +0200 4/12/02, Paolo Molaro wrote:
>On 04/11/02 Dan Sugalski wrote:
>>  I'm not sure which is worse--the amount of data we're copying around,
>>  or the fact that we eat Mono's lunch while we do so.
>
>:-)
>Could you post the code for the sample?

Simon did a one-for-one translation of life.pasm to C# and we were 
rather significantly faster. (I'd much rather use .NET numbers, but 
we don't currently have them)

FWIW, the numbers were:

No JIT:  Parrot  866 gen/sec  Mono  11 gen/sec
    JIT:  Parrot 1068 gen/sec  Mono 114 gen/sec

We can't find the original--I've attached the version he's got now, 
but it's apparently even slower.

>Is it based on the snipped Simon
>posted a while ago where it used the pattern:
>
>       string buffer = "";
>       ...
>       for (...) {
>               buffer += "*";
>       }
>
>A string in the CLR is completely different from a scalar in the perl
>world. A string is immutable, so when you use the += operator on it,
>it really creates a new object each time, so, if the test uses that
>pattern it's comparing apples and oranges. At the very least, you should
>use a StringBuilder (or, if you want to really compare the language/VM
>implementation differences, you'd use a simple char[] array in the C#
>case).

In this case, it is apples to apples under the hood--concatenation in 
Parrot currently generates new strings as well. The only place (at 
the moment) we don't do immutable strings is for chomp.

On the other hand, there's a very strong "Who cares?" argument. 
(Targeted directly at the CLR design, not at Mono) If the design of 
the CLR requires certain operations to be really slow, well... 
they're going to be slow, and code that uses it will be stuck with 
lousy speeds. It *is* apples to apples comparison of speeds, since 
we're both doing concatenation. That you're potentially saddled with 
a slow design isn't my fault. :)
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                       teddy bears get drunk

Attachment: %life.cs
Description: application/applefile

Attachment: life.cs
Description: Binary data

Reply via email to