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
版权声明:本文为博主原创文章,转载请附上博文链接!