[Mono-dev] ToString() performace in Mono

Petit Eric surfzoid at gmail.com
Thu Nov 22 04:24:11 EST 2007


Do you try to replace String by a System.Text.StringBuilder ?

2007/11/22, pablosantosluac <pablosantosluac at terra.es>:
> Hi,
>
>
> I've detected a performance hit on "plastic server" running on mono. I was
> actually shocked because when I checked something similar working with
> integers, Mono was actually faster than .NET. But it seems it is not the
> case with strings.
>
> Please consider the following code sample:
>
>
> using System;
>
> namespace compareCompare
> {
>     class Class1
>     {
>         static void Main(string[] args)
>         {
>             int ini = Environment.TickCount;
>
>             string k = string.Empty;
>
>             for( int i = 0; i < 6000000; ++i )
>             {
>                 k = i.ToString();
>             }
>
>             Console.WriteLine("val is {0} and time {1}", k,
> Environment.TickCount - ini);
>         }
>     }
> }
>
>
> And the following results:
>
> >compareCompare.exe
> val is 5999999 and time 3525
>
> >"c:\Archivos de programa\Mono-1.2.5.2\bin\mono.exe" compareCompare.exe
> val is 5999999 and time 11577
>
>
> Thanks,
>
>
> pablo
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>



More information about the Mono-devel-list mailing list