i like this post (click again to cancel)
0
i dont like this post (click again to cancel) remove favorite mark from this question (click again to restore mark)

Is there a way to profile code that has been compiled with Cython?

flag offensive community wiki
add comment
2 Answers:
i like this answer (click again to cancel)
2
i dont like this answer (click again to cancel)

See http://wiki.cython.org/Profiling

  • Dev version of Cython has some support for profiling using Python's cProfile module. This seems like an easy way out. See: http://hg.cython.org/cython-devel/rev/bcc850a1253a

  • Apart from that, standard C profiling tools should apply: Valgrind + KCacheGrind (see Cython's wiki), oprofile, qprof (on 32-bit systems), sprof. These ones are mostly for Linux, though, AFAIK.

add comment
i like this answer (click again to cancel)
0
i dont like this answer (click again to cancel)

It is also very, very useful to do

cython -a file.pyx

and look at the generated .html file. The more yellow a line, the more Python C/API calls are made. This is "profiling" in a different sense, in that it profiles at compile time how likely a given line of code is to be slow. (Credit: This cython -a feature is something that my student, Robert Bradshaw, implemented.)

add comment
Your answer:
You are now not logged in but you can answer first and then login
toggle preview

Tags:

✕2
✕1
✕1
✕1
✕1

Asked: 2 years, 6 months ago

Seen: 2,838 times

Last updated: 1 year, 6 months ago

Made with Django.