Accurate timing of functions in python

后端 未结 7 1061
一向
一向 2020-11-30 19:23

I\'m programming in python on windows and would like to accurately measure the time it takes for a function to run. I have written a function \"time_it\" that takes another

7条回答
  •  感动是毒
    2020-11-30 19:51

    Instead of writing your own profiling code, I suggest you check out the built-in Python profilers (profile or cProfile, depending on your needs): http://docs.python.org/library/profile.html

提交回复
热议问题