问题
I have a remoting application (2 player Magic the Gathering Game) using windows form in C# and I am seeing very poor performance in mono. One thing I can think of that might affect the performance is that I have custom images for button background and form backgrounds(.png). Moreover I heavily use card images (.jpg). Lastly I have stuck very strictly to .NET 2.0.
What can I look for to improve windows Form performance in mono? If this is not possible is there a quick winforms to gtk# converter or tool that helps in converting?
回答1:
Did you try to profile your code. Maybe that shows you where the bottlenecks are...
I think one big problem is
Whereas the .Net implementation is a binding to the Win32 toolkit, the Mono implementation is written in C# to allow it to work on multiple platforms
as mentioned here and
System.Windows.Forms in Mono is implemented using System.Drawing. All controls are natively drawn through System.Drawing. System.Windows.Forms implements its own driver interface to communicate with the host OS windowing system.
as described here.
I don't know of a converter from winforms to gtk#..., but if you really want to bother with converting your game to gtk#, this might be a good starting point.
回答2:
It would be useful if you could detail exactly what the performance problems are that you are observing.
Mono's Windows.Forms implementation is a bit slower today due to some of the requirements imposed by trying to support the WndProc model embedded into it properly.
It is an area that could be improved and likely many of the lessons from Wine could be applied to Mono's Winforms implementation.
回答3:
Have you tried profiling it? Mono has a built-in profiler. There's a page on the mono website about the mono profiler and other performance tips.
来源:https://stackoverflow.com/questions/614478/how-do-i-improve-performance-of-winforms-application-in-mono