From: Steve C. <ste...@ya...> - 2004-12-22 17:32:44
|
On Wed, 2004-12-22 at 15:43 +0100, Arnd Baecker wrote: >From this we get for all **Agg backends that > - new_gc > - _draw_solid > - draw_text > eat up a major part of the time. > Another important part is spread in the draw chain > (for example from 74.3% in to 47.0 %+10.3 % in GTKAgg). I've noticed that that new_gc() is called many times (60 times when running simple_plot.py) with each call creates a new GraphicsContext instance. I think it would be more efficient to create just one GC instance and reuse it. It would suit the way that the Cairo, PS and possibly SVG and Agg backends do their drawing but that might mean completely changing the way the matplotlib frontend does its drawing. > P.S: we just looked at backend_gtk.py. > Couldn't one safely replace > > def draw_lines(self, gc, x, y): > x = x.astype(nx.Int16) > y = self.height*ones(y.shape, nx.Int16) - y.astype(nx.Int16) > self.gdkDrawable.draw_lines(gc.gdkGC, zip(x,y)) > > > by > > def draw_lines(self, gc, x, y): > x = x.astype(nx.Int16) > y = self.height - y.astype(nx.Int16) > self.gdkDrawable.draw_lines(gc.gdkGC, zip(x,y)) > > ? It might give a small improvement. I hope so because I made this change to the code a few weeks ago and it is now in the file backend_gdk.py in matplotlib 0.65! It looks like you are running an old version of matplotlib. Steve |