robertwb / issues-import-test

0 stars 0 forks source link

Optimise for-in-zip() loops when all loop variables have non-Python types #869

Open robertwb opened 9 years ago

robertwb commented 9 years ago

Probably just a bit of a wild idea, but this:

def test(a, b):
    cdef int x, y
    for x, y in zip(a, b):
        ...

could be optimised using a Cython-implemented helper function template for zip() that calls next() separately on all iterators, converts the values to their specific target types (thus a template) and returns a ctuple instead of a Python tuple.

Migrated from http://trac.cython.org/ticket/871