如何使用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
版权声明:本文为博主原创文章,转载请附上博文链接!
如何使用Psyco为你的Python程序提速的更多相关文章
- 运行python程序
1 在windows下运行python程序 1)从DOS命令行运行python脚本 用python解释器来执行python脚本,在windows下面python解释器是python.exe,我的pyt ...
- 【python之路2】CMD中执行python程序中文显示乱码
在IDLE中执行下面代码,中文显示正常: # -*- coding:utf-8 -*- st=raw_input("请输入内容")print st 但在CMD中执行e:\hello ...
- Python程序高效地调试
现在我在debug python程序就只是简单在有可能错误的地方print出来看一下,不知道python有没像c++的一些IDE一样有单步调试这类的工具?或者说各位python大神一般是怎么debug ...
- python学习笔记-python程序运行
小白初学python,写下自己的一些想法.大神请忽略. 安装python编辑器,并配置环境(见http://www.cnblogs.com/lynn-li/p/5885001.html中 python ...
- python程序一直在后台运行的解决办法
刚写了个python程序,要一直在后台运行,即使断开ssh进程也在,下面是解决办法: 假如Python程序为test.py 编写shell脚本start.sh #!/bin/bash python t ...
- 第一个python程序
一个python程序的两种执行方式: 1.第一种方式是通过python解释器: cmd->python->进入python解释器->编写python代码->回车. 2.第二种方 ...
- Python程序的首行
>问题 >>在一些python程序中的首行往往能够看见下面这两行语句中的一句 >>>#!/usr/bin/Python >>>#!/usr/bin ...
- Python程序员的进化史
各种程序员所写的阶乘算法代码 # -*- coding: utf-8 -*- #新手程序员(递归) def factorial(x): if x == 0: return 1 else: return ...
- Python程序的常见错误(收集篇)
关于Python Python是一门解释性的,面向对象的,并具有动态语义的高级编程语言.它高级的内置数据结构,结合其动态类型和动态绑定的特性,使得它在快速应用程序开发(Rapid Applicatio ...
随机推荐
- Visual Studio 12无法调试Silverligh应用程序的问题
环境: Win7 Ultimate X64 Visual Studio 12 (以下简称 VS12) Internet Explorer 9(以下简称 IE9) Silverlight5_x64 ad ...
- 设置安卓开机动画、开机logo
我们要修改的是system>media文件夹下的bootanimation.zip(手机开机动画)这个文件 先来讲讲这个文件结构:该zip解压后得到两个文件, 第一个目录存放了开机时播放的图片( ...
- java多个文件压缩下载
public static void zipFiles(File[] srcfile,ServletOutputStream sos){ byte[] buf=new byte[1024]; try ...
- Jememeter和Loadrunner测试MySQL性能
From:http://blog.csdn.net/testingstar/article/details/60579454 MySQL数据库性能测试的方法 前置条件: 安装系统:windows 7 ...
- Selenium系列之--08 操作已打开的浏览器
Can Selenium interact with an existing browser session? 参考上面的文章 1. 建一个ReuseWebDriver类 import java.io ...
- python datetime获取几分钟、小时、天之前的时间
import datetime print ((datetime.datetime.now()-datetime.timedelta(days=1)).strftime("%Y-%m-%d ...
- javascript 高级编程系列 - 基本数据类型
javascript中的基本数据类型包括: Undefined, Null, Boolean, Number, String 5种数据类型 1. Undefined 类型 (只有一个值 undefin ...
- upstart man
man upstart nit(8) init(8) NAME init - Upstart process management daemon SYNOPSIS init [OPTION]... D ...
- 【iOS开发-79】利用Modal方式实现控制器之间的跳转
利用Modal方法.事实上就是以下两个方法的运用. Modal方式的切换效果是从底部呈现. -(void)clickModal{ WPViewController *wp=[[WPViewContro ...
- Core Data 版本号迁移经验总结
大家在学习和使用Core Data过程中,第一次进行版本号迁移的经历一定是记忆犹新,至少我是这种,XD.弄的不好,就会搞出一些因为迁移过程中数据模型出错导致的Crash.这里总结了一下Core Dat ...