[Mono-dev] [PATCH] Add GetString to UnicodeEncoding 2.0 andmodifysome Encoding wrappers

Kornél Pál kornelpal at gmail.com
Wed Apr 12 07:25:57 EDT 2006


I included Stopwatch.cs in the exe. (Removed MonoTODO and compiled.) And 
used the same executable on 2.0 as well with a config file. (This was a lazy 
solution but is fine.:)

Kornél

----- Original Message ----- 
From: "Atsushi Eno" <atsushi at ximian.com>
To: "Kornél Pál" <kornelpal at gmail.com>
Cc: <mono-devel-list at lists.ximian.com>
Sent: Wednesday, April 12, 2006 1:13 PM
Subject: Re: [Mono-dev] [PATCH] Add GetString to UnicodeEncoding 2.0 
andmodifysome Encoding wrappers


> Just a small doubt: how could you run your test that uses Stopwatch
> under 1.x profile?
>
> Atsushi Eno
>
> Kornél Pál wrote:
>> Hi,
>>
>> I've done some tests:
>> New 1.1:
>> UnicodeEncoding: 6750
>> ASCIIEncoding: 18609
>> UTF8Encoding: 9922
>> CP932: 14641
>>
>> New 2.0:
>> UnicodeEncoding: 13594
>> ASCIIEncoding: 19562
>> UTF8Encoding: 16625
>> CP932: 38906
>>
>> Old 1.1:
>> UnicodeEncoding: 6906
>> ASCIIEncoding: 18859
>> UTF8Encoding: 10062
>> CP932: 21719
>>
>> Old 2.0:
>> UnicodeEncoding: 6750
>> ASCIIEncoding: 7297
>> UTF8Encoding: 16719
>> CP932: 45469
>
>> using System;
>> using System.Diagnostics;
>> using System.IO;
>> using System.Text;
>>
>> namespace Test
>> {
>>     public class Test
>>     {
>>         public static int loop;
>>         public static string s;
>>
>>         public static void Main(string[] args)
>>         {
>>             loop = args.Length > 1 ? int.Parse(args[1]) : 100;
>>             s = File.OpenText(args[0]).ReadToEnd();
>>
>>             Do(Encoding.Unicode);
>>             Do(Encoding.ASCII);
>>             Do(Encoding.UTF8);
>>             Do(Encoding.GetEncoding(932));
>>         }
>>
>>         public static void Do(Encoding e)
>>         {
>>             Stopwatch sw = Stopwatch.StartNew();
>>             for (int i = 0; i < loop; i++)
>>                 e.GetBytes(s);
>>             sw.Stop();
>>             Console.WriteLine(e.GetType().Name + ": " + 
>> sw.ElapsedMilliseconds.ToString());
>>         }
>>     }
>> }
> 




More information about the Mono-devel-list mailing list