我已经编写了 2 个功能完全相同的功能,但我不知道哪个更快更好.如何比较这两个函数,看看哪一个在性能和所有方面都更好?
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?
timeit
模块就可以了.
The timeit
module will do ya.
这篇关于如何在性能方面比较 python 函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!