如何在python中计算程序运行时间?

菲斯基:

如何在python中计算程序运行时间?

JoshAdel:

您可能需要看一下该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模块也可能派上用场,尽管我更喜欢后两项关于基准测试和性能分析代码性能的建议:

http://docs.python.org/library/time.html

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章