Response times of GTK vs GTKAgg backends

I'm developing an application for personal use on my Mac, using the GTAgg backend, which renders a series of plots in a figure in a pygtk scrolled window. I'm currently using matplotlib 0.87.3 installed via Fink. Matplotlib is performing well.

Today I had occasion to log into my Mac over ssh from work. I noted that the application was extremely slow to display the plots. Running locally on my Mac, the application takes about 5 seconds to display the plots when it opens. Remotely, it took around 5 minutes (repeatable). On a whim, I tried changing to the GTK backend - now it displayed the plots in about 20 seconds, which is quite acceptable considering it is remote access over an ssh tunnel.

I checked the CPU usage on both the Mac, and my work PC - the CPU usage was very, very low on both machines, so I'm not sure where the bottleneck lies. My install rights on the work PC are very restricted, so I'm using CygWin via XLiveCD, which I have copied onto the hard drive to speed it up.

http://xlivecd.indiana.edu/

This poor performance when using GTKAgg isn't really a problem - I'll code a command line switch to change to the GTK backend for the few times I need remote access. I'm reporting it just in case one of the developers thinks it could be useful to troubleshoot, in case it highlights a problem in the code. I also want to note that the GTK backend is useful to some people, and hope that it will continue to be supported (I seem to recall one mention that it was little used).

Thanks for matplotlib.

Kevin Horton
Ottawa, Canada

Kevin Horton wrote:

I'm not sure where the bottleneck lies

I don't know any details of either of the GTK back-ends, but this sounds
like what I'd expect.

With the *Agg backends, the rendering is done by Agg, generating an
image in memory, and then the entire image is passed (one way or
another) to the X-server to render. This is pretty quick with a local
X-server, but it is a lot of data to pass over a network.

In contrast, the with the non-Agg back ends, the rendering is done by
the X-server, with MPL passing it drawing commands, rather than images.
In general, there is a lot less data to pas over the network with way,
so it's going to be faster.

I also want to note that the GTK backend is useful to some people, and hope that it will continue to be supported (I seem to recall one mention that it was little used).

This is a good point. In general, the Agg back-ends produce nicer an
more consistent results, and, on local machines, performance is just
fine, but in a remote X-session, there are real advantages to using X
for the rendering. The same probably applies to the TK and Wx back-ends
also.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Thanks for the explanation on the difference in these backends.

I did notice many artifacts in the plots when using the GTK backend, especially when only setting xmin and xmax to only display a small portion of the data . Is this a known problem? Is there interest in correcting it, and if so, is there any information I can provide to assist, or any testing I can do?

Kevin Horton
Ottawa, Canada

···

On 7-Sep-06, at 12:05 PM, Christopher Barker wrote:

Kevin Horton wrote:

I also want to note that the GTK
backend is useful to some people, and hope that it will continue to
be supported (I seem to recall one mention that it was little used).

This is a good point. In general, the Agg back-ends produce nicer an
more consistent results, and, on local machines, performance is just
fine, but in a remote X-session, there are real advantages to using X
for the rendering. The same probably applies to the TK and Wx back-ends
also.