[Mono-dev] Big performance gaps between .NET, Mono (Suse/Debian) ?

Lionel Cuir lionel_email at aulofee.com
Tue Oct 6 09:34:17 EDT 2009

Thanks for the answers
Interesting remarks. I voluntarily added the allocation of objects within
the mesurable time, to have an overall picture (and I was not aware of the
mono GC's relative slowness). 
I modified my tests as you advised but the results still show a big
difference between .net and mono. Could it be that the "measuring window"
still include GC work? Could you have a look at my code (see attached file)
to see if we agree on what should be preallocated in order to put apart the
GC? Apart for the int32 preallocation (I don't know if preallocating value
type can be meaningful), the code is supposed to preallocate both
dictionaries + the IPAddresses.
Here are the results with preallocation (again, what's matter is not the
exact value but the magnitude):
Preallocated int32 Dictionary test
4937 DotNet
9856 Mono on light Debian
9554 Mono on Suse
Preallocated IPAddress Dictionary test
8375 DotNet
16414 Mono on light Debian
17084 Mono on Suse


De : Alan McGovern [mailto:alan.mcgovern at gmail.com] 
Envoyé : mardi 6 octobre 2009 12:46
À : Lionel Cuir
Cc : mono-devel-list at lists.ximian.com
Objet : Re: [Mono-dev] Big performance gaps between .NET, Mono (Suse/Debian)

Calling 'ToString' is just a GC benchmark. Yes, the current mono GC is
slower than the .NET GC in this scenario. Your other tests also do a fair
bit of allocating, so it's quite possible the entire performance loss you're
seeing is just from the GC kicking in. If you want to test how fast you can
add elements to a Dictionary, pre-allocate all the objects first and then
time just the addition.


On Tue, Oct 6, 2009 at 10:15 AM, Lionel Cuir <lionel_email at aulofee.com>

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)
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 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

Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20091006/29534a3d/attachment.html 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: TestPerfBasic2.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20091006/29534a3d/attachment.pl 

More information about the Mono-devel-list mailing list