[Mono-dev] ToString() performace in Mono

pablosantosluac pablosantosluac at terra.es
Thu Nov 22 04:14:45 EST 2007


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 




More information about the Mono-devel-list mailing list