Marien Zwart, 03.05.2010 20:22: > http://trac.cython.org/cython_trac/ticket/447 describes an added > optimization for calls to list.pop(). Somewhat counter-intuitively this > optimization is only applied if pop() is called on things of type > "object", not if it is called on things explicitly typed as "list". > Compare the following (silly) examples: > > def f(): > cdef list l = [] > l.append(0) > l.pop() > return l > > def f(): > cdef object l = [] > l.append(0) > l.pop() > return l > > Using either Cython 0.12.1 or cython-devel the second one generates > calls to __Pyx_Object_Append and __Pyx_Object_Pop, which take fast paths > if called on a list. The first one generates a direct to PyList_Append, > but then PyObject_GetAttr and PyObject_Call for pop().
Yes, I stumbled over that, too, but didn't care to fix it so far. I'll look into it. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
