如何使用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的使用说明书。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值