已安装PyPy + NumPy,但我的性能没有任何改善。这是正常的吗?

时间:2015-07-09 15:59:51

标签: python performance numpy pypy

操作系统:Ubuntu 14.04

CPU:i7

  1. 我安装了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
    
  2. 使用pythonpypy

    跟随代码
    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 
    
  3. 即。没有性能提升。我应该获得性能提升吗?

0 个答案:

没有答案