Ah -- just thought of something else. If I adjust simple_plot_fps.py to have 100,000 data points rather than 1,000 I see something that starts to match with what you're seeing:
GtkAgg: wallclock: 4.23297405243 user: 3.33 fps: 23.6240522057 Gtk: wallclock: 15.0203828812 user: 14.92 fps: 6.65761990165 TkAgg: wallclock: 4.8252530098 user: 4.67 fps: 20.7243018754 You can see that the Gtk time is starting to explode. If I go to 1,000,000 points, Gtk runs out of memory before the first plot, whereas the other two continue to chug along at a reasonable pace. From looking at the code, I suspect the crucial difference is that the Gdk backend uses the Python sequence API (rather slow) to access the data as it gets rendered, whereas GtkAgg uses the numpy array interface which is essentially raw access to a C array. So -- try using GtkAgg if you can get away with it. The only real advantage of the raw Gtk (Gdk specifically) backend is when running over a remote X connection. If that's not an option for you, I don't have any easy solution that comes to mind. It's sort of a pygtk issue -- it would have to be rewritten to take numpy arrays which is probably unlikely to happen in the official codebase. Matplotlib has a little more control over what happens in the Agg backend, since the Python wrapper is included in matplotlib. Hope that information helps. Cheers, Mike Michael Droettboom wrote: > In my own tests, using the built-in GUI windows I get the following > numbers on the simple_plot_fps.py speed test (which essentially tests > redrawing speed, which is pretty GUI-backend dependent, as opposed to > the first drawing operation which involves more common code): > > GtkAgg: > wallclock: 3.73636507988 > user: 2.9 > fps: 26.7639799276 > > Gtk: > wallclock: 1.99883008003 > user: 1.99 > fps: 50.0292651181 > > TkAgg: > wallclock: 4.55140709877 > user: 4.41 > fps: 21.9712273216 > > So you can see that GtkAgg is actually slightly faster than TkAgg, and > Gtk (if you can accept the lower rendering quality), is almost 2x as fast. > > So, if you're certain the same amount of data is being plotted in the > default Tk window and your custom Gtk window, it seems to suggest that > the slowdown is probably something in how you're embedding it. > (Obviously the number of data points as a significant impact on speed > regardless of backend.) I'm not enough of a Gtk expert that anything in > what you're doing jumps out at me. What triggers the call to > "plotFrictionProfile?" Is that possible that is getting called more > times than you expect? > > Cheers, > Mike > > steve george wrote: >> Hi, >> >> I don't have conclusive proof, .. but I suspect that the draw() of a >> graph in a pyGTK application is order of magnitudes slower than I can >> plot the same data in the default Tk graphing widget. >> >> i.e. 5 sec in tk, ... and >1 minute in gtk >> >> Obvious question, ... is this a know issue? >> Is there any tricks in gtk to speed up the draw() >> >> Attached is a heavily snipped example of bits and pieces of my code, >> maybe I have structured my program incorrectly? >> >> Thanks for any comments >> Steve >> >> >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------- >> Check out the new SourceForge.net Marketplace. >> It's the best place to buy or sell services for >> just about anything Open Source. >> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users