Can you add the following to the header of the file (if applicable):

#cython: cdivision=True
#cython: boundscheck=False
#cython: nonecheck=False
#cython: wraparound=False

That should speed up the code more.