Improve efficiency of generated cython code