From: Eric F. <ef...@ha...> - 2007-08-01 18:14:12
|
Fernando, Here is some more information about profiling that others may find useful: 1) The profile module reports times that are much longer than normal; I don't know to what extent the relative times are still correct; my impression is that they do still give a decent idea of where the bottlenecks and resource hogs are. 2) The combination of hotshot and hotshot2calltree (or similar) gets badly confused by duplicate function names such as __init__, so the kcachegrind view can be quite misleading. 3) A solution is to use the cProfile module in Python 2.5 with an appropriate reformatter. The following script runs a python script through cProfile and generates a *.log file that kcachegrind reads: http://www.gnome.org/~johan/lsprofcalltree.py So the sequence is simply python lsprofcalltree.py testscript.py kcachegrind testscript.py.log & Here are a couple of relevant Google results: https://lists.dulug.duke.edu/pipermail/yum-devel/2007-January/003045.html http://ddaa.net/blog/python/lsprof-calltree Eric Fernando Perez wrote: > On 7/31/07, Darren Dale <dd...@co...> wrote: > >> I am attaching the results for two different tests. One is loading the default >> mpl-data/matplotlib.conf, the other is loading an empty >> ~/.matplotlib/matplotlib.conf. I haven't done much work with profiling, maybe >> others can make some comments about the results. > > I'm afraid I can't help with this right now, but you may want to look at > > http://amath.colorado.edu/faculty/fperez/python/profiling/ > > the little code I put in there makes using kcachegrind very easy for > python profiling, and it's really a useful tool for analyzing > profiling info. > > Cheers, > > f |