如何使用Psyco为你的Python程序提速
psyco加速Python执行速度的方法:
要求:
版本对照:
File name Python versions Well-tested with
psyco-x.y-win32-py2.2.2.exe 2.2.2 and up 2.2.2 and 2.2.3
psyco-x.y-win32-py2.3.exe 2.3 and up 2.3 and 2.3.3
psyco-x.y-win32-py2.4.exe 2.4 and up 2.4.*
psyco-x.y-win32-py2.5.exe 2.5 and up 2.4
操作系统,CPU的限制:
# A 32-bit architecture. A Pentium or any other Intel 386 compatible processor is recommended.
# Linux, Mac OS/X, Windows, BSD are known to work.
# A regular Python installation, version 2.2.2 or up. Psyco is not a replacement for the Python interpreter and
libraries, it works on top of them.
使用psyco
import psyco
psyco.full()#对所有函数用psyco进行编译
psyco.bind(myfunction1)#对选中的函数用psyco进行编译
g = psyco.proxy(f) #对函数f用psyco进行编译
g(args) # Psyco-accelerated call 编译后g函数速度会有提升
f(args) # regular slow call f函数保持原来的调用速度
psyco.log # 用来记录日志 Enable logging to a file named xxx.log-psyco by default, where xxx is the name of the
script you ran.
psyco.profile() # 可以替代psyco.ful()
psyco.log()
psyco.full(memory=100) #参数是什么意思没看懂。
psyco.profile(0.05, memory=100)#0.05,memeoy=100 参数也没看懂。
psyco.profile(0.2)
参考:http://psyco.sourceforge.net/psycoguide/index.html psyco的使用说明书。
转载自 :http://biansutao.iteye.com/blog/352394
---------------------
作者:longzhiwen888
来源:CSDN
原文:https://blog.csdn.net/longzhiwen888/article/details/46562665
版权声明:本文为博主原创文章,转载请附上博文链接!
posted on 2018-12-23 22:00 ExplorerMan 阅读(330) 评论(0) 编辑 收藏 举报
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步