title: Cython performance benchmark
body: <p>I am trying to get a FLOPS benchmark for cython and numpy.  I wrote a program in cython for this purpose.  Here it is:</p>
  
  <pre><code>cimport numpy as np
  import numpy as np
  import time
  
  cimport cython
  @cython.boundscheck(False)
  @cython.wraparound(False)
  def numpybenchmark():
  
      cdef np.ndarray[np.float64_t, ndim=2] m1 = np.random.rand(3,3)
      cdef np.ndarray[np.float64_t, ndim=1] m2 = np.random.rand(3)
      cdef np.ndarray[np.float64_t, ndim=1] res
  
      cdef int niters = 10000000
      cdef int x
  
      t1 = time.time()
      for x in range(niters):
          res = np.dot(m1, m2)
      t2 = time.time()
      cdef double numopsperloop = 9. + 6.
      cdef double totalops = numopsperloop * float(niters)
      cdef double mflops = totalops / (t2-t1) / 1024. / 1024.
      print 'Computed MFLops is: ' + str(mflops)
  </code></pre>
  
  <p>On my machine I measure "Computed MFLops is: 7.42390102416".  My machine has an Intel Core i7-6700HQ CPU @ 2.6 GHz and is running Windows 10.</p>
  
  <p>If you want to run it on your machine, save the code in a file called "benchmark.pyx".  Then create a file called "setup.py" with the following contents:</p>
  
  <pre><code>from distutils.core import setup                                                                 
  from Cython.Build import cythonize                                                               
  import numpy                                                                                     
  
  setup(                                                                                           
      ext_modules = cythonize("benchmark.pyx"), 
      include_dirs=[numpy.get_include()]                                                           
  )  
  </code></pre>
  
  <p>Then you should be able to compile it with "python setup.py build_ext --inplace" .  On windows it might be a little more difficult as I ran into the dreaded "unable to find vcvarsall.bat" error and had to spend significant effort working around that.                                                                                               </p>
  
  <p>This performance seems pretty poor to me.  I'm wondering if someone can run it on their platform and tell me what you get?  or point out any obvious error that made in my code that is adversely affecting performance?</p>
  
  <p>thanks!</p>