[Mono-dev] how to improve mono performance

Atsushi Eno atsushi at ximian.com
Fri Nov 18 01:03:25 EST 2005

zhu shi song wrote:
> (1) I feel a little disappointed at the comparsion
> results.  I think we should not only prove we can do
> this but we can do even better.  The performance fact
> is very essential for production applications.  I hope
> the mono community can improve performance of mono
> largely. Then mono will be depoyed in many real apps. 
> We have spent so much effort on it, we shouldn't let
> it be reference implementation just for lab.

I agree that performance improvements are impressive, but
against your expectation mono is already used in practice,
including softwares and individual solutions:

> (2) when I use msft's csc to compile compare.cs, then
> I run under linux+mono.  I just got 10% faster than
> that compiled by mono mcs. So maybe mono's jit is not
> so good as msft's.

Wrong assumption. There are three factors in mono to affect
on performance:

	- class libraries
	- compiler outputs
	- JIT

The most effective optimizations could be done at class libraries
(which could be usually done with a few lines of changes on a few
critical paths), where many hot users among users turned into hackers
and posting several patches here (and there).

Actual analysis and thoughts on which affects on performance
are welcome (like what Ben wrote).

It would be awesome if you try mono --profile (or "heap-buddy"
in our svn repository) to count individual performance, find
out where the code is specially slow, and optimize the sources.

Even a line of change could result in more than 200% performance
boost in some code areas (I often got such hits in DOM/XSLT areas).

Atsushi Eno

>   tks
>   zhu
> --- Ben Maurer <bmaurer at ximian.com> wrote:
>> On Wed, 2005-11-16 at 20:30 -0800, zhu shi song
>> wrote:
>>> I've got one test example and tested it using
>> linux
>>> mono and windows .NET on the same machine.  The
>>> results showed that the performance of linux mono
>> is
>>> much bad than windows .NET. 
>>> Linux Mono:
>>>  ArrayList strings test.............3311 ms
>>>  StringBuilder test.................4008 ms
>>>  Integer & Floating ADD.............15145 ms
>>>  Exception test.....................621 ms
>>>  Reflection and recursion...........9421 ms
>>> Windows .Net:
>>>  ArrayList strings test.............1109 ms
>>>  StringBuilder test.................1437 ms
>>>  Integer & Floating ADD.............2734 ms
>>>  Exception test.....................4046 ms
>>>  Reflection and recursion...........5843 ms
>>> Machine configuration:
>>>  RAM: 512M DDR
>>>  CPU: Intel C4 2.0G
>>> OS:
>>>  Windows 2003 Server .NET 1.1 Framework
>>>  Fedora Core 4 with mono compiled from svn
>>> Now I try to port my aspx web application to linux
>>> mono from windows 2003 .net framework.  But
>> regarding
>>> of performance, I wonder whether it is deserved.
>>>   Maybe I lack some tips to improve linux mono
>>> performance.  If someone knows pls help me.
>> Chances are, your web application does not add items
>> to an array, create
>> stringbuilders, add integers, throw exceptions and
>> do reflection
>> anything like the tests you have configured. I would
>> suggest
>> benchmarking a ported application rather than these
>> micro measurements.
>> If you want to do such measurements, I would
>> recommend something more
>> relevant to your application (database accesses? the
>> asp.net pipeline?)
>> That being said, some possible reasons for slowness:
>> ArrayList/StringBuilder:
>> 	Likely the GC.
>> Floating Point:
>> 	I think msft may be taking advantage of some
>> special hardware stuff. I
>> highly doubt this is relevant to your application.
>> Exceptions:
>> 	We super optimized this path :-)
>> Reflection:
>> 	Not sure, might be worth looking at
>> -- Ben
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> _______________________________________________
> 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