操作系统:Ubuntu 14.04
CPU:i7
我安装了PyPy + Numpy:
sudo add-apt-repository ppa:pypy/ppa
sudo apt-get update
sudo apt-get install pypy pypy-dev
pip install git+https://bitbucket.org/pypy/numpy.git
使用python
和pypy
import numpy as np
import time
start = time.clock()
for i in range(5):
vv = np.random.rand(9000000).astype(np.float32)
m = np.mean(vv)
print 'Done in %.3f s %s ' % (time.clock()-start,m)
得到以下时间:
$python testSpeed_.py
Done in 1.908 s 0.499997
$pypy testSpeed_.py
Done in 4.599 s 0.499952167273
即。没有性能提升。我应该获得性能提升吗?