ENH: optimize Cython take functions with memcpy where possible