I\'m struggling with this using timeit and was wondering if anyone had any tips
Basically I have a function(that I pass a value to) that I want to test the speed of
A note for future visitors. If you need to make it work in pdb
debugger, and superMegaIntenseFunction
is not in the global scope, you can make it work by adding to globals
:
globals()['superMegaIntenseFunction'] = superMegaIntenseFunction
timeit.timeit(lambda: superMegaIntenseFunction(x))
Note that the timing overhead is a little larger in this case because of the extra function calls. [source]