如何在python中计算程序运行时间?
您可能需要看一下该timeit
模块:
http://docs.python.org/library/timeit.html
或profile
模块:
http://docs.python.org/library/profile.html
这里还有一些不错的教程:
http://www.doughellmann.com/PyMOTW/profile/index.html
http://www.doughellmann.com/PyMOTW/timeit/index.html
而且该time
模块也可能派上用场,尽管我更喜欢后两项关于基准测试和性能分析代码性能的建议:
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句