[Numpy-discussion] profiling line by line

Robert Kern robert.kern@gmail....
Mon Sep 15 10:18:45 CDT 2008

On Mon, Sep 15, 2008 at 05:27, Robin <robince@gmail.com> wrote:
> Hi,
> I am using the prun feature of Ipython which is very helpful.
> I was wondering though if theres anything for Python that would allow
> line-by-line profiling (ie a time for each line of code) like the
> MATLAB profiler?

I don't think there is anything out there at the moment. Python does
have a hook for line-by-line tracing, and one can make a line-by-line
profiler from it. To do it with the least overhead, you need to use
the C API for it and a C callback. I do have some Cython code that
does this. It needs a little bit more work, though. I'll try to push
it out soonish.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco

More information about the Numpy-discussion mailing list