[Python-3000] A better way to initialize PyTypeObject

Guido van Rossum guido at python.org
Thu Nov 30 02:51:58 CET 2006


I don't know about this one. But I'm sure that the CVS history of
typeobject.c (in the 2.2a through 2.3 era, probably) would show that
serious hacks were necessary to make certain slots perform well
enough. I remember doing quite a bit of performance tuning with some
incredible results -- all to make it competitive with classic classes.

On 11/29/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Brett Cannon wrote:
>
> > Or the other option is that in the future we just don't have the
> > distinction and make sure that the __getitem__ methods do the requisite
> > type checks.  The type check is done at some point in the C code anyway
> > so it isn't like there is a performance reason for the different slots.
>
> The performance reason is that C code can call the
> sq_getitem slot with a C integer directly, without
> having to convert to a Python integer and back
> again.
>
> Has anyone ever tested whether this is an important
> enough gain to be worth keeping the dual slots?
>
> --
> Greg
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list