黄山附近景点上各景点用手机百度地图导航准吗

安装psyco加快python运行速度
用psyco能加快python的速度
psyco可以让python程序跑的和C一样快&http://psyco.sourceforge.net&
python.exe setup.py install build --compiler=mingw32
安装完模块后,只需要在你的python文件开始加上&
pysco.full()&
另外,使用psyco.profile()可以对大程序进行适当分析,以确定哪些函数最值得编译。
psyco.log()函数用来记录profile()得到的信息,下次就可以运行就能更快一点。
psyco.bind(myfunc)指定对函数myfunc进行编译,可以做到比full()更精细的控制。
psyco.proxy(f)创建一个新的函数,它的代码是由f编译得到二进制码
import math, timeit,
def TestA():
res, loopcnt = 0.0, 100
for i in range(loopcnt):
& & for j in
range(loopcnt):
& for k in range(loopcnt):
& & & res = res
+ math.sin(i+j+k) & # loopcnt^3 times
__name__=='__main__':
TestB = psyco.proxy(TestA)
ta = timeit.Timer("TestA()", "from __main__ import
tb = timeit.Timer("TestB()", "from __main__ import
print("TestA(): %.2fs" % (ta.timeit(10)))
print("TestB(): %.2fs" % (tb.timeit(10)))
运行结果如下:
$ python test.py
TestA(): 15.84s
TestB(): 1.82s
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。如何使用Psyco为你的Python程序提速。 - 边苏涛的博客 - ITeye技术网站
博客分类:
psyco加速Python执行速度的方法:
版本对照:
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
psyco-x.y-win32-py2.5.exe
2.5 and up
操作系统,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.
import psyco
psyco.full()#对所有函数用psyco进行编译
psyco.bind(myfunction1)#对选中的函数用psyco进行编译
g = psyco.proxy(f) #对函数f用psyco进行编译
# Psyco-accelerated call 编译后g函数速度会有提升
# 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的使用说明书。
浏览: 40655 次
来自: 北京
这个Pytrhon代码不知道起源在在哪?distance_ma ...
可以用的,谢谢了……
这个 我用在jsp里面怎么 中文变英文了呀。【图文】Python内部培训_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
评价文档:
Python内部培训
上传于|0|0|文档简介
&&Python内部培训
大小:276.05KB
登录百度文库,专享文档复制特权,财富值每天免费拿!
你可能喜欢

我要回帖

更多关于 黄山附近景点 的文章

 

随机推荐