On Wed, May 6, 2009 at 6:23 AM, Stefan Behnel <[email protected]> wrote: > What we tend to call PY_NEW here is a direct call to a type's tp_new(), > which handles both the allocation and the basic initialisation of an > instance. Cython could do a tiny bit better here, since we know exactly > what function a cdef class has in its tp_new slot. However, that function > will always recursively run into the base type's tp_new and at the end of > the chain into the one of Python's 'type' type, and there is not much we > can do to improve this situation in general.
Well, you could optimize tp_new. You could have it call the base type's tp_new directly, instead of through a vtable (at least if the base type is a Cython type); or better yet, inline the base type's tp_new (for Cython base types). (Gary Furnish complained that calling through the tp_new chain was a major expense if you had a deep inheritance hierarchy; I haven't confirmed this myself, but it sounds plausible.) Carl _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
