pythonppt_Python ppt包_程序模块 - PyPI - Python中文网

PPT-Python性能调谐器

ppt是调整Python程序性能的工具

安装pip install ppt

示例

计时importpptimporttimeif__name__=='__main__':for_inrange(10):ppt.time('big')time.sleep(0.5)# Big computationppt.time('medium')time.sleep(0.3)# Medium computationppt.time('fast')time.sleep(0.01)# Fast computation# Stop current timingppt.stop()# Print current timingsppt.summary()# Detailed statistics from pstatsppt.stats()

输出big: 40 function calls in 5.006 seconds

medium: 40 function calls in 3.003 seconds

fast: 40 function calls in 0.101 seconds

********** big **********

40 function calls in 5.006 seconds

Ordered by: cumulative time

ncalls tottime percall cumtime percall filename:lineno(function)

10 5.005 0.501 5.005 0.501 {built-in method time.sleep}

10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:42(time)

10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:17(stop)

10 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}

********** medium **********

40 function calls in 3.003 seconds

Ordered by: cumulative time

ncalls tottime percall cumtime percall filename:lineno(function)

10 3.003 0.300 3.003 0.300 {built-in method time.sleep}

10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:42(time)

10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:17(stop)

10 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}

********** fast **********

40 function calls in 0.101 seconds

Ordered by: cumulative time

ncalls tottime percall cumtime percall filename:lineno(function)

10 0.101 0.010 0.101 0.010 {built-in method time.sleep}

9 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:42(time)

10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:17(stop)

1 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:53(stop)

10 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}

绘制

下面启动visdom服务器并绘制4行随机样本。importpptimportrandom,timeif__name__=='__main__':ppt.plot(1)ppt.plot(1)ppt.plot(1)ppt.plot(1)foriinrange(10):forsessionin['a','b','c','d']:time.sleep(0.2)ppt.plot(random.random(),session)ppt.close()

欢迎加入QQ群-->: 979659372

group.png

推荐PyPI第三方库

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值