ENH: optimize Cython take functions with memmove where possible