[Python-Dev] s/hotshot/lsprof

skip@pobox.com skip at pobox.com
Mon Nov 21 21:06:24 CET 2005

    Jeremy> Here's another attempt to disentagle some issues:
    Jeremy> - Should lsprof be added to the standard distribution?
    Jeremy> - Should hotshot be removed from the standard distribution?

Adding another log to the fire, what about statprof, a sampling profiler,
which Neil Schemenauer mentioned?  I installed it here at work.  Seems to
work as advertised.  Took me about two minutes to modify our main app to
accept a -P command line flag to enable statprof profiling.  It has the
beauty of being minimally invasive since it only samples the execution state
every 100ms or so.  Of course, sampling profilers have their own warts, but
they avoid some of the problems of instrumenting profilers.

Another tack to take would be to modify the generated byte code to only
increment counts for each basic block, similar to what gcc's -pg flag does.
I think that would yield a fully instrumented profiler, but one that's less
invasive than the current alternatives.  It could maybe be implemented as an
import hook.  Of course, such a beast has yet to be written, so this email
and a couple bucks will get you a cup of coffee.

This entire discussion simply serves to demonstrate that there are lots of
different ways to skin this particular cat.  How many of these various
alternatives belong in the standard library remains to be seen.


More information about the Python-Dev mailing list