I am trying to optimize some code with Cython, but cProfile is not providing enough information.
To do a good job at profiling, should I create many su
Yes, it does. The finest granularity available to cProfile
is a function call. You must split up func1 into multiple functions. (Note that you can make them functions defined inside func1 and thus only available to func1.)
If you want finer-grained profiling (line-level), then you need a different profiler. Take a look at this line-level profiler, but I don't think it works for Cython.
You need to enable profiling support for your Cython code. Use
# cython: profile=True
http://docs.cython.org/src/tutorial/profiling_tutorial.html