Does effective Cython cProfiling imply writing many sub functions?

一世执手 提交于 2019-12-02 09:54:28

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!