Hi all,
Previously I was a user of gnuplot but have been giving matplotlib a
try. One thing I've run in to right away is that matplotlib appears
to be significantly slower.
A script to produce a dozen plots was taking me ~1 second with
gnuplot, and now takes me ~18 seconds with matplotlib.
I'm curious if anyone knows how to speed things up. To figure out
what is taking most of the time, I've used cProfile and pstats and
below is the top 15 functions taking the most time.
(note: "plotStackedJobsVsTime" is my function that uses matplotlib.)
----------------------------------------
Wed Nov 11 08:43:52 2009 fooprof
3069840 function calls (3009711 primitive calls) in 17.658
CPU seconds
Ordered by: cumulative time
List reduced from 873 to 15 due to restriction <15>
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 17.658 17.658 <string>:1(<module>)
1 0.007 0.007 17.658 17.658 /cms/cmsprod/bin/
prodJobMonitorPlots_matplotlib.py:151(main)
13 0.620 0.048 17.647 1.357 /cms/cmsprod/bin/
prodJobMonitorPlots_matplotlib.py:54(plotStackedJobsVsTime)
13 0.000 0.000 10.087 0.776 /afs/hep.wisc.edu/cms/
sw/python/x86_64/2.5.4/lib/python2.5/site-packages/
matplotlib-0.99.1.1_r0-py2.5-linux-x86_64.egg/matplotlib/figure.py:959
(savefig)
13 0.028 0.002 10.086 0.776 /afs/hep.wisc.edu/cms/
sw/python/x86_64/2.5.4/lib/python2.5/site-packages/
matplotlib-0.99.1.1_r0-py2.5-linux-x86_64.egg/matplotlib/
backend_bases.py:1372(print_figure)
13 0.028 0.002 9.847 0.757 /afs/hep.wisc.edu/cms/
sw/python/x86_64/2.5.4/lib/python2.5/site-packages/
matplotlib-0.99.1.1_r0-py2.5-linux-x86_64.egg/matplotlib/backends/
backend_agg.py:357(print_png)
13 0.000 0.000 9.243 0.711 /afs/hep.wisc.edu/cms/
sw/python/x86_64/2.5.4/lib/python2.5/site-packages/
matplotlib-0.99.1.1_r0-py2.5-linux-x86_64.egg/matplotlib/backends/
backend_agg.py:307(draw)
3206/13 0.040 0.000 9.222 0.709 /afs/hep.wisc.edu/cms/
sw/python/x86_64/2.5.4/lib/python2.5/site-packages/
matplotlib-0.99.1.1_r0-py2.5-linux-x86_64.egg/matplotlib/artist.py:44
(draw_wrapper)
13 0.001 0.000 9.222 0.709 /afs/hep.wisc.edu/cms/
sw/python/x86_64/2.5.4/lib/python2.5/site-packages/
matplotlib-0.99.1.1_r0-py2.5-linux-x86_64.egg/matplotlib/figure.py:729
(draw)
13 0.005 0.000 9.200 0.708 /afs/hep.wisc.edu/cms/
sw/python/x86_64/2.5.4/lib/python2.5/site-packages/
matplotlib-0.99.1.1_r0-py2.5-linux-x86_64.egg/matplotlib/axes.py:1632
(draw)
26 0.029 0.001 5.624 0.216 /afs/hep.wisc.edu/cms/
sw/python/x86_64/2.5.4/lib/python2.5/site-packages/
matplotlib-0.99.1.1_r0-py2.5-linux-x86_64.egg/matplotlib/axis.py:727
(draw)
1533/1325 0.078 0.000 3.663 0.003 /afs/hep.wisc.edu/cms/sw/
python/x86_64/2.5.4/lib/python2.5/site-packages/matplotlib-0.99.1.1_r0-
py2.5-linux-x86_64.egg/matplotlib/axis.py:61(__init__)
811 0.035 0.000 3.057 0.004 /afs/hep.wisc.edu/cms/
sw/python/x86_64/2.5.4/lib/python2.5/site-packages/
matplotlib-0.99.1.1_r0-py2.5-linux-x86_64.egg/matplotlib/axis.py:181
(draw)
13 0.001 0.000 2.619 0.201 /afs/hep.wisc.edu/cms/
sw/python/x86_64/2.5.4/lib/python2.5/site-packages/
matplotlib-0.99.1.1_r0-py2.5-linux-x86_64.egg/matplotlib/legend.py:342
(draw)
1065/961 0.012 0.000 2.543 0.003 /afs/hep.wisc.edu/cms/
sw/python/x86_64/2.5.4/lib/python2.5/site-packages/
matplotlib-0.99.1.1_r0-py2.5-linux-x86_64.egg/matplotlib/axis.py:1207
(_get_tick)
----------------------------------------
My script, for the curious, is at
http://www.hep.wisc.edu/cms/comp/routerqMonitor/prodJobMonitorPlots_matplotlib.py
and produces these plots:
http://www.hep.wisc.edu/cms/comp/routerqMonitor/index.html
Any hints at what I can do to speed up my script? Or is it out of my
hands because it's all in matplotlib?
Thanks for any help,
Mike
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users