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程序提速的更多相关文章

  1. 运行python程序

    1 在windows下运行python程序 1)从DOS命令行运行python脚本 用python解释器来执行python脚本,在windows下面python解释器是python.exe,我的pyt ...

  2. 【python之路2】CMD中执行python程序中文显示乱码

    在IDLE中执行下面代码,中文显示正常: # -*- coding:utf-8 -*- st=raw_input("请输入内容")print st 但在CMD中执行e:\hello ...

  3. Python程序高效地调试

    现在我在debug python程序就只是简单在有可能错误的地方print出来看一下,不知道python有没像c++的一些IDE一样有单步调试这类的工具?或者说各位python大神一般是怎么debug ...

  4. python学习笔记-python程序运行

    小白初学python,写下自己的一些想法.大神请忽略. 安装python编辑器,并配置环境(见http://www.cnblogs.com/lynn-li/p/5885001.html中 python ...

  5. python程序一直在后台运行的解决办法

    刚写了个python程序,要一直在后台运行,即使断开ssh进程也在,下面是解决办法: 假如Python程序为test.py 编写shell脚本start.sh #!/bin/bash python t ...

  6. 第一个python程序

    一个python程序的两种执行方式: 1.第一种方式是通过python解释器: cmd->python->进入python解释器->编写python代码->回车. 2.第二种方 ...

  7. Python程序的首行

    >问题 >>在一些python程序中的首行往往能够看见下面这两行语句中的一句 >>>#!/usr/bin/Python >>>#!/usr/bin ...

  8. Python程序员的进化史

    各种程序员所写的阶乘算法代码 # -*- coding: utf-8 -*- #新手程序员(递归) def factorial(x): if x == 0: return 1 else: return ...

  9. Python程序的常见错误(收集篇)

    关于Python Python是一门解释性的,面向对象的,并具有动态语义的高级编程语言.它高级的内置数据结构,结合其动态类型和动态绑定的特性,使得它在快速应用程序开发(Rapid Applicatio ...

随机推荐

  1. 关于Label::createWithBMFont中资源文件使用的坑爹问题解决方式

    1.问题 使用Label的createWithBMFont,结果.fnt的资源总是找不到或者获取数据失败.原来.fnt资源的使用须要配合该资源的.png共同 使用,如bitmapFontTest3.f ...

  2. 绝不要在构造函数和析构过程中调用virtual函数

    下面是一个用来塑模股市交易的类: derived的类的构造函数被调用,但是首先得调用基类Transaction的构造函数,但是在后面还得调用virrual函数,这个时候子类的对象的构造还没有完成,那么 ...

  3. 轻松搞定RabbitMQ(二)——工作队列之消息分发机制

    转自 http://blog.csdn.net/xiaoxian8023/article/details/48681987 上一篇博文中简单介绍了一下RabbitMQ的基础知识,并写了一个经典语言入门 ...

  4. Unity3D总结:关于射线碰撞

    方法一:Physics.Raycast 光线投射 1.static function Raycast (origin : Vector3, direction : Vector3, distance  ...

  5. caffe学习--使用caffe中的imagenet对自己的图片进行分类训练(超级详细版) -----linux

    http://blog.csdn.net/u011244794/article/details/51565786 标签: caffeimagenet 2016-06-02 12:57 9385人阅读  ...

  6. VMware Workstation 11 安装MAC OS X 10.10 Yosemite(14B25)图解 2015-01-13 12:26:01|

    VMware Workstation 11 安装MAC OS X 10.10 Yosemite(14B25)图解 2015-01-13 12:26:01|  分类: 网络互联 |  标签:10.10  ...

  7. Coding/Github/Bitbucket 地址

    Coding:https://coding.net/u/OberonTony Github:https://github.com/Oberon-Tonya Bitbucket:https://bitb ...

  8. java 定义一个同步map内存去重法

    实例:

  9. LeetCode:二叉树的非递归中序遍历

    第一次动手写二叉树的,有点小激动,64行的if花了点时间,上传leetcode一次点亮~~~ /* inorder traversal binary tree */ #include <stdi ...

  10. C++代码书写模板 -- 如何判断函数类型

    先说一个简单的方案. 经过验证 g++ 和 vs2010 都可以.原理就是利用函数类型可以直接转换成函数指针. template<class T> bool test( T * t ) { ...