I'm currently setting my MemoryViews in my Cython pyx file as follows:
@cython.boundscheck(False)
cdef int[:] fill_memview():
# This happens inside a big loop so needs to be fast
cdef int[:] x = np.empty(10)
for i in range(10):
x[i] = i
return x
cdef stupid_loop():
for i in range(10000):
fill_memview()
When I compile the pyx file with cython -a foo.pyx the line cdef int[:] x = np.empty(10) shows in the resulting annotated html file in dark yellow (meaning it has lots of Python calls slowing things down.)
How can I instatiate my typed Memoryview better?