Hello, Can anybody help me to understand why, on simple performance tests, I see so different results between .NET and Mono on various Linux platforms? Are my tests incorrect? Did I have no luck and simply fall on some methods/functionality better implemented by MS? And why is there such a difference between Suse and Debian for the IPAddress dictionary? Any help appreciated (please, no trolling, no political debate - just ideas about how to improve things or ideas to point out methodology errors I would have made in my tests) Regards, Lionel A few hints on how I did my tests: - the OS are: a bare XP SP3, a bare OpenSuse (kernel 2.6.27), a Debian with a lightened kernel (2.6.30) - "bare" = the OS is up-to-date but no other software installed - all OS were running as vmware guest (in vm workstation 6.5) with two "cpus" (dual-core T7200) and 512Mo of RAM
- Mono version was 2.4.2.3 on Suse, and 2.5 (compiled from SVN r140059) on Debian. .NET version is 3.5 - On Suse and Debian, I both run the tests with the exe compiled with csc (.net) and with the exe compiled with gmcs - the results were the same. You'll find attached the sample code I used - I test basically a dictionary of int, a dictionary of IPAddress and the IPAddress.ToString method. The duration of the test (in millisec are: int32 Dictionary test 4812 DotNet 9493 Mono on light Debian 9815 Mono on Suse IPAddress Dictionary test 13500 DotNet 29533 Mono on light Debian 41732 Mono on Suse IPAddress.ToString test 2453 DotNet 16665 Mono on light Debian 17747 Mono on Suse
using System; using System.Collections.Generic; using System.Net; namespace Test { public class Class1 { static void Main(string[] args) { TestPerfOnDico(); TestPerfOnIpAddress(); } static void TestPerfOnIpAddress() { Console.WriteLine("IPAddress.ToString test"); long sum = 0; int count = (int)Math.Pow(10, 7); Console.Write("Iterations (def={0:0,0})? ", count); string sChoice = Console.ReadLine(); if (!string.IsNullOrEmpty(sChoice)) count = int.Parse(sChoice); IPAddress ip; for (int i = 0; i < 100; i++) { ip = new IPAddress(i); sum += ip.ToString().Length; } Console.WriteLine("Dummy: " + sum); sum = 0; DateTime start = DateTime.UtcNow; for (int i = 0; i < count; i++) { ip = new IPAddress(i); sum += ip.ToString().Length; } TimeSpan duration = DateTime.UtcNow.Subtract(start); Console.WriteLine("Total: " + sum); Console.WriteLine("Duration: " + duration.TotalMilliseconds); } static void TestPerfOnDico() { int count = (int)Math.Pow(10, 8); Console.Write("Iterations (def={0:0,0})? ", count); string sChoice = Console.ReadLine(); if (!string.IsNullOrEmpty(sChoice)) count = int.Parse(sChoice); Console.WriteLine("int32 Dictionary test"); DateTime start = DateTime.UtcNow; int intDicoSizeMax = 10000; Dictionary<int, int> dicoInt = new Dictionary<int, int>(); for (int i = 0; i < count; i++) { int key = (int)((((long)i) * 5 + 11) % intDicoSizeMax); dicoInt[key] = i; } TimeSpan duration = DateTime.UtcNow.Subtract(start); Console.WriteLine("Duration for int dico (in millisec): " + duration.TotalMilliseconds); Console.WriteLine("IPAddress Dictionary test"); start = DateTime.UtcNow; int iPAddressDicoSizeMax = 10000; Dictionary<IPAddress, IPAddress> dicoIP = new Dictionary<IPAddress, IPAddress>(); for (int i = 0; i < count; i++) { long key = ((((long)i) * 5 + 11) % iPAddressDicoSizeMax); IPAddress ip = new IPAddress(key); dicoIP[ip] = ip; } duration = DateTime.UtcNow.Subtract(start); Console.WriteLine("Duration for IP dico (in millisec): " + duration.TotalMilliseconds); } } }
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list