Popular recipes tagged "profile" but not "parse"http://code.activestate.com/recipes/tags/profile-parse/2012-12-07T01:21:04-08:00ActiveState Code RecipesProfile Manager (Cave Story) (Python) 2012-12-07T01:21:04-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578368-profile-manager-cave-story/ <p style="color: grey"> Python recipe 578368 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/manager/">manager</a>, <a href="/recipes/tags/profile/">profile</a>). </p> <p>If you have ever played a game that only had one save slot and wanted to be able to manage profiles, the following code written for Cave Story may be of use to you. The recipe provides a starting point for how one might go about writing a profile manager for such a program that runs through a command interface.</p> Profile decorator (Python) 2011-08-02T19:08:58-07:00Giampaolo RodolĂ http://code.activestate.com/recipes/users/4178764/http://code.activestate.com/recipes/577817-profile-decorator/ <p style="color: grey"> Python recipe 577817 by <a href="/recipes/users/4178764/">Giampaolo RodolĂ </a> (<a href="/recipes/tags/profile/">profile</a>, <a href="/recipes/tags/profiling/">profiling</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>A decorator for profiling a function which prints profiling results to stdout. This was originally proposed as a patch for inclusion into python stdlib:</p> <p><a href="http://bugs.python.org/issue9285" rel="nofollow">http://bugs.python.org/issue9285</a></p> <p>Note that on certain Linux systems pstats module isn't available, despite it is supposed to be part of Python stdlib. On my Ubuntu box I had to run "sudo apt-get install python-profile" first.</p> quick Python profiling with hotshot (Python) 2009-02-20T22:35:07-08:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/576656-quick-python-profiling-with-hotshot/ <p style="color: grey"> Python recipe 576656 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/hotshot/">hotshot</a>, <a href="/recipes/tags/performance/">performance</a>, <a href="/recipes/tags/profile/">profile</a>). Revision 2. </p> <p>This is a quick snippet that I use occasionally to profile some pure-Python code, using <a href="http://docs.python.org/library/hotshot.html#module-hotshot"><code>hotshot</code></a>. Basically it is this:</p> <ol> <li>Put this <code>@hotshotit</code> decorator on the function you want to profile.</li> <li>Run your code through some representative paces. The result will be a <code>&lt;functionname&gt;.prof</code> in the current directory.</li> <li>Process the <code>.prof</code> file and print the top 20 hotspots with the given "show_stats.py" script.</li> </ol> <p>Props to <a href="http://blogs.activestate.com/toddw/">Todd</a> for slapping this code together.</p> <p>Hotshot <a href="http://docs.python.org/library/profile.html">is a little out of favour</a> now, so I should -- or Todd :) -- should really come up with an equivalent that uses <code>cProfile</code>.</p>