啥也没写
分类: Python/Ruby
2013-01-08 14:38:10
wget
tar -jxvf pypy-1.9-linux64.tar.bz2
mv pypy-1.9 /usr/local/pypy
ln -s /usr/local/pypy/bin/pypy /usr/bin/pypy
[root@openstack ~]# pypy
pypy: error while loading shared libraries: libbz2.so.1.0: cannot open shared object file: No such file or directory
ln -s /lib64/libbz2.so.1.0.4 /lib64/libbz2.so.1.0
wget
wget
pypy distribute_setup.py
pypy get-pip.py
/usr/local/pypy/bin/easy_install web.py
http://www.ibm.com/developerworks/cn/opensource/os-pypy-intro/
[root@openstack ~]# time ./python-fib.py
real 1m16.530s
user 1m16.447s
sys 0m0.036s
[root@openstack ~]#
[root@openstack ~]# time ./pypy-fib.py
real 0m21.011s
user 0m20.937s
sys 0m0.056s
[root@openstack ~]# cat python-fib.py
#!/usr/bin/env python
def fib(n):
if n <2:
return n
else:
return fib(n-1)+fib(n-2)
fib(40)
[root@openstack ~]# cat pypy-fib.py
#!/usr/bin/env pypy
def fib(n):
if n <2:
return n
else:
return fib(n-1)+fib(n-2)
fib(40)