[Enthought-Dev] Line profiling of Cython code

Robert Kern rkern at enthought.com
Thu Aug 5 11:01:35 CDT 2010

On Thu, Aug 5, 2010 at 2:34 AM, Gael Varoquaux
<gael.varoquaux at normalesup.org> wrote:
> Hi there,
> I _love_ Robert's line profiler. It's been so useful to me many times.
> Is there a way to do line-by-line profiling of cython code using it? If
> not, what would you recommend for this purpose?

At this time, there really aren't any such tools. The Cython folks
have plans to do something like this, though. Now that they can fake
frames, it actually shouldn't be too hard for them to insert the
appropriate tracing calls. We would just need to figure out how to
tell line_profiler which functions it should be profiling. Currently,
I use the kernprof.py script, which provides the @profile decorator,
which extracts the code object from the function and keys off of that.

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 Enthought-Dev mailing list