How do I compare python functions in terms of performance?
I have written 2 functions doing the exact same thing, but I don't know which one is faster and better. How do I compare these 2 functions to see which one is better in terms of performance and everything? The timeit module will do ya. Once you've found out which function is faster using the timeit module, you can also get more precise details of where the differences are by using the profile module. 来源: https://stackoverflow.com/questions/7956834/how-do-i-compare-python-functions-in-terms-of-performance