Suggestions for improving speed of matplotlib

I'm currently use the Agg background, and my graphs
are taking about 2.5 seconds each. I'm primarily using
matplotlib to generate stock ticker graphs and will
generating tens of thousands of graphs throughout the
day.

I read that the SVG was the fastest backend. I tried
it but the speed comes out to be around 4 seconds. The
file size from Agg is about 50k and from SVG is about
400k which might explain why it's taking so long.

I'm using a derivation of the plotDaySummary to do the
charts. the charts are large size 1000x700

I tried psyco but that improved the chart times by
about 7%.

Any and all sugestions would be appreciated. Do you
think rewriting the plot_day_summary with Pyrex would
help?

Thanks,

VJ

Someone here may have some ideas, but you're really going to need to do some profiling to find out where your bottlenecks are. If most of the time is spent in the actual Agg drawing calls, no amount of Pyrex, psyco, etc will help.

By they way, I haven't looked in the source, but does matplotlib (and the Agg back-end) use "vectorized" calls to the drawing? AS an example, with wxPython, calling DC.DrawPointList() with an NX2 array of point coordinates is orders of magnitude faster than looping through the array and calling DC.DrawPoint() thousands of times. The overhead of that round-trip between Python and C++ is substantial. Maybe tricks like that could speed up the Agg back-end too.

-Chris

Vinj Vinj wrote:

···

I'm currently use the Agg background, and my graphs
are taking about 2.5 seconds each. I'm primarily using
matplotlib to generate stock ticker graphs and will
generating tens of thousands of graphs throughout the
day.

I read that the SVG was the fastest backend. I tried
it but the speed comes out to be around 4 seconds. The
file size from Agg is about 50k and from SVG is about
400k which might explain why it's taking so long.

I'm using a derivation of the plotDaySummary to do the
charts. the charts are large size 1000x700

I tried psyco but that improved the chart times by
about 7%.

Any and all sugestions would be appreciated. Do you
think rewriting the plot_day_summary with Pyrex would
help?

Thanks,

VJ

-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
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...