title: Cython fastest way to initialize memory views
body: <p>I'm working on a real time data processing program in python and for the data crunching section I'm using cython.</p>
  <p>Unfortunately initializing a numpy array using <strong>np.zeros</strong> is rather slow. I found that creating the array once at the startup and then looping through the values and setting them to zero is faster than creating a new array.</p>
  <pre><code>@cython.wraparound(False)
  @cython.boundscheck(False)            
  cpdef zeros_int32(unsigned long long[::1] arr):
      cdef unsigned int x
      with nogil:
          for x in range(arr.shape[0]):
              arr[x] = 0
  </code></pre>
  <p>However I find this to be quite hacky. Is there a better way to initialize an array with all the values set to 0? perhaps using malloc and free? I know in C++ you can do something like:</p>
  <pre><code>uint_32t emptyArray[number_of_elements];
  </code></pre>
  <p>which creates the array with all values set to 0 but I can't seem to get it to work in cython.Once again I only care about the speed of the code so it doesn't matter if it looks messy or not very readable as long as it executes as fast as possible.</p>
  <p>Any help would be much appreciated.</p>