python计算运行时间(转)
来源:互联网 发布:域名运营商查询 编辑:程序博客网 时间:2024/06/16 12:47
# -*- coding: utf-8 -*-# !/bin/env pythondef test1(): n = 0 for i in range(101): n += i return ndef test2(): return sum(range(101))def test3(): return sum(x for x in range(101))if __name__ == '__main__': from timeit import Timer t1 = Timer("test1()", "from __main__ import test1") t2 = Timer("test2()", "from __main__ import test2") t3 = Timer("test3()", "from __main__ import test3") print(t1.timeit(1000000)) print(t2.timeit(1000000)) print(t3.timeit(1000000)) print(t1.repeat(3, 1000000)) print(t2.repeat(3, 1000000)) print(t3.repeat(3, 1000000))
0 0
- python计算运行时间(转)
- Python程序运行时间计算
- Python计算程序运行时间
- Python计算程序运行时间
- Python计算程序运行时间
- python计算程序运行时间
- Python计算程序运行时间
- Python计算程序运行时间
- 计算Python代码的运行时间
- python装饰器计算函数运行时间
- Python基础-计算程序运行时间
- python程序运行时间-期权组合计算
- Python计算函数的运行时间
- C、Java及Python中计算程序运行时间
- Python学习笔记———《计算程序运行时间》
- 计算Python的代码块或程序的运行时间
- 使用python装饰器计算函数运行时间
- 计算Python的代码块或程序的运行时间
- 第2周项目2 程序的多文件组织
- STFCN笔记
- caffe中特殊的layer解释
- 获取其他App中资源的方法
- c++中的类型转换
- python计算运行时间(转)
- 1748. The Most Complex Number/LG的数学计划~~~持续更新ing(反素数求解)
- Java泛型通配符
- The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDat
- 网络流24题—— 试题库问题
- ZooKeeper集群-搭建指南
- Fresco基本使用
- 欢迎使用CSDN-markdown编辑器
- libgdx绘制线段