From: Gökhan S. <gok...@gm...> - 2010-03-19 15:39:15
|
On Thu, Mar 18, 2010 at 6:21 PM, Andrew Hawryluk <HA...@no...>wrote: > I've observed a significant difference in the time required by different > plotting functions. With a plot of 5000 random data points (all > positive, non-zero), plt.semilogx takes 3.5 times as long as plt.plot. > (Data for the case of saving to PDF, ratio changes to about 3.1 for PNG > on my machine.) > > I used cProfile (script attached) and found several significant > differences between the profiles of each plotting command. On my first > analysis, it appears that most of the difference is due to increased use > of mathtext in semilogx: > > ================================== > Plotting command > ================================================================== > cumtime (s) plot semilogx semilogy loglog > ================================================================== > total running time 0.618 2.192 0.953 1.362 > axis.py:181(draw) 0.118 1.500 0.412 0.569 > text.py:504(draw) 0.056 1.353 0.290 0.287 > mathtext.py:2765(__init__) 0.000 1.018 0.104 0.103 > mathtext.py:2772(parse) --- 1.294 0.143 0.254 > pyparsing.py:1018(parseString) --- 0.215 0.216 0.221 > pyparsing.py:3129(oneOf) --- 0.991 --- --- > pyparsing.py:3147(<lambda>) --- 0.358 --- --- > lines.py:918(_draw_solid) 0.243 0.358 0.234 0.352 > ================================================================= > > It seems that semilogx could be made as fast as semilogy since they have > to do the same amount of work, but I'm not sure where the differences > lie. Can anyone suggest where I should look first? > > Much thanks, > > Andrew Hawryluk > > matplotlib.__version__ = '0.99.1' > Windows XP Professional > Version 2002, Service Pack 3 > Intel Pentium 4 CPU 3.00 GHz, 2.99 GHz, 0.99 GB of RAM > > > Hello, How did you get the cumtime listing? The output of the run doesn't produce a cumulative sum table as you showed here. ================================================================================ Platform : Linux-2.6.31.9-174.fc12.i686.PAE-i686-with-fedora-12-Constantine Python : ('CPython', 'tags/r262', '71600') NumPy : 1.5.0.dev8038 Matplotlib : 1.0.svn ================================================================================ -- Gökhan |