[Gtk-sharp-list] gtk-dotnet performance
Scott Ellington
scottellington at comcast.net
Wed Mar 1 11:26:26 EST 2006
Hi Jonathan,
I have just tried your test app and I am not seeing times near 1 second:
Frame 197: 116 msec
Frame 198: 148 msec
Frame 199: 106 msec
As for your first option, there is definitely a memory leak ocurring. I
could not pinpoint where that is, but I believe you are incorrect in
thinking that it is the Gtk.DotNet.Graphics.FromDrawable (window) in the
Expose Event. I do that exact thing with no such memory leak:
http://forge.novell.com/modules/xfmod/svn/svnbrowse.php?uri=filedetails.php%3Frepname%3Dappomattox%26path%3D%252Ftrunk%252FAppomattox%252Fsrc%252FAppomattox.Gui.Components%252FMapCanvas.cs
Scott
On Tue, 2006-02-28 at 22:07 -0500, Jonathan Resnick wrote:
> I am trying to port an open-source medical imaging application from .NET to
> Mono so that it can run on Linux. A large part of the codebase is based on
> the System.Drawing library - therefore I am trying to use the gtk-dotnet
> bridge so that GTK can be used as a front end. However, I'm having a hard
> time getting decent performance, and as far as I can tell, the problems seem
> to stem from the gtk-dotnet component.
>
> I've attached a sample application that just tries to flip two
> System.Drawing.Bitmaps to a Gtk.DrawingArea, alternating them, in a tight
> loop. It measures the time taken for each flip and prints it to the console.
>
> On Linux, I observe the following behaviour:
>
> 1. My first approach was to try drawing directly to the screen (_drawDirect
> = true in the OnExposeEvent handler). The performance is good for roughly
> the first 100 or so loop iterations, but then it quickly degrades. It seems
> as though the system starts to run out of memory, which seems to be caused
> by creating a Graphics object using Gtk.DotNet.Graphics.FromDrawable inside
> the OnExposeEvent handler.
>
> 2. My second approach was to try drawing to an intermediate Pixmap
> (_drawDirect = false in the OnExposeEvent handler), so as to avoid having to
> create a Graphics object each time. In this case, the performance is
> constant over the entire duration of the loop. However, the performance is
> pretty bad, taking roughly 1 second per flip, which is not acceptable for
> our purposes (and I'm running it on a reasonably powerful laptop machine).
>
> If someone with a solid understanding of Gtk/Gdk could look at my sample
> code and point out to me where I'm going wrong, it would be a huge help in
> getting this application running on Linux.
>
> Thanks,
>
> Jonathan
>
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
More information about the Gtk-sharp-list
mailing list