title: Cython optimization slow
body: <p>I am trying to optimize the following python code with cython:</p>
  <pre><code>from cython cimport boundscheck, wraparound
  
  @boundscheck(False)
  @wraparound(False)
  def cython_color2gray(numpy.ndarray[numpy.uint8_t, ndim=3] image):
      cdef int x,y,z
      cdef double z_val, grey
      for x in range(len(image)):
          for y in range(len(image[x])):
              grey = 0
              for z in range(len(image[x][y])):
                  if z == 0:
                      z_val = image[x][y][0] * 0.21
                      grey += z_val
                  elif z == 1:
                      z_val = image[x][y][1] * 0.07
                      grey += z_val
                  elif z == 2:
                      z_val = image[x][y][2] * 0.72
                      grey += z_val
              image[x][y][0] = grey
              image[x][y][1] = grey
              image[x][y][2] = grey
      return image
  </code></pre>
  <p>However, when checking if everything is as optimized as it should be, I receive the following yellow lines (see picture). Is there anything else I can do to optimize this cython code and make it run faster?</p>
  <p><a href="https://i.stack.imgur.com/Bo97x.png" rel="nofollow noreferrer">Output cython file</a></p>