In the midst of GSoC, I wanted to float an idea about a Cython profiler, similar to the current Python profiler. Specifically I wanted to see if there's interest, what sorts of features would be desired, and, broadly, some implementation ideas.
I think the arguments in favor are clear: Often people use Cython incrementally -- take a .py file, profile it, put the hotspots in Cython. If fast enough -- you're done. If not, continue to put more slow python code into Cython, or determine if the Cython code should be massaged to yield better performance. In the latter case it is difficult to zone in on the Cython hotspot, for it is not possible for the Python profiler to see it. Other external tools must be used (gprof?, valgrind, mac os x-specific profiler), which is inconvenient at best; other times they are just plain unavailable. I'd like to see a profiling option to the cython compiler that would allow the user to, as seamlessly as possible, run the compiled extension module with profiling enabled, and have the user interaction be just like the current python profiler, specifically with meaningful output for the Cython-level functions. If possible, I'd like to have the cython profiling code make use of the python cProfiler module so profiling isn't any different between pure Python & Cython compiled code. I don't know how feasible hooking up with the python cProfiler is, so it is just in the pie-in-the-sky stage right now. Another tantalizing possibility would be line-by-line profiling, beyond the the regular function-level profiling. What other features would be desired? What user interaction features would be good to have? Implementation-wise, it could be done as its own transform, enabled by compile-time switch. Someone else (Robert? in some thread?) mentioned somewhere about getting debugger-support in Cython, allowing one to step through Cython code just like pdb (one can use gdb currently, of course). I imagine the implementation issues for a Cython debugger would overlap a good deal with the profiler (it would be its own separate tranform, obviously). I'll put each in a CEP, hopefully soon (and after the benefits of comments, etc.) Kurt _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
