Does effective Cython cProfiling imply writing many sub functions?

后端 未结 2 1183
礼貌的吻别
礼貌的吻别 2021-01-27 18:10

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

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-27 18:25

    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.

提交回复
热议问题