Python如何给你的程序做性能测试
问题 你想测试你的程序运行所花费的时间并做性能测试。 解决方案 如果你只是简单的想测试下你的程序整体花费的时间, 通常使用Unix时间函数就行了,比如: bash % time python3 someprogram.py real 0m13.937s user 0m12.162s sys 0m0.098s bash % 如果你还需要一个程序各个细节的详细报告,可以使用 cProfile 模块: bash % python3 -m cProfile someprogram.py 859647 function calls in 16.016 CPU seconds Order
下载地址
用户评论