I changed the current type pointer check to look at tp_basicsize instead.

> That made it work for almost all classes in lxml's own Element hierarchy,
> with only a couple of exceptions in lxml.objectify that have one additional
> object field. So, just extending the freelist support to use two different
> lists for different struct sizes instead of just one would make it work for
> all of lxml already. Taking a look at Sage to see how the situation appears
> over there would be interesting, I guess.
>

I found some chains of length 5.  This could be shortened to 4 by putting
the freelist at the level of Element (which is where you most care about
speed of object creation).

SageObject
    -> Element (_parent attribute and cdef methods)
    -> Vector (_degree)
    -> FreeModuleElement (_is_mutable)
    -> FreeModuleElement_generic_dense (_entries)

SageObject
    -> Element (_parent attribute and cdef methods)
    ->sage.structure.element.Matrix (_nrows)
    -> sage.matrix.matrix.Matrix (_base_ring)
    -> Matrix_integer_dense (_entries)

This does look cool to have though.
David
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to