How do I compare python functions in terms of performance?

前端 未结 2 1331
没有蜡笔的小新
没有蜡笔的小新 2021-02-20 08:46

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 o

相关标签:
2条回答
  • 2021-02-20 09:15

    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.

    0 讨论(0)
  • 2021-02-20 09:31

    The timeit module will do ya.

    0 讨论(0)
提交回复
热议问题