给你的程序做基准测试-python cookbook(第3版)高清中文完整版

时间:2024-06-29 23:06:53
【文件属性】:

文件名称:给你的程序做基准测试-python cookbook(第3版)高清中文完整版

文件大小:4.84MB

文件格式:PDF

更新时间:2024-06-29 23:06:53

python cookbook 第3版 高清 中文完整版

14.13 给你的程序做基准测试 问题 You would like to find out where your program spends its time and make timing measurements. 解决方案 If you simply want to time your whole program, it’s usually easy enough to use something like the Unix time command. For example: bash % time python3 someprogram.py real 0m13.937s user 0m12.162s sys 0m0.098s bash % On the other extreme, if you want a detailed report showing what your program is doing, you can use the cProfile module: bash % python3 -m cProfile someprogram.py 859647 function calls in 16.016 CPU seconds Ordered by: standard name


网友评论