[pypy-issue] [issue1122] [cpyext] PyVarObject builtins and definition of Py_SIZE()

Stefan Behnel tracker at bugs.pypy.org
Wed Apr 11 12:10:19 CEST 2012


Stefan Behnel <stefan_ml at behnel.de> added the comment:

> since Py_SIZE() usage is discouraged for builtin type, which code 
> would benefit of a mirrored ob_size?

Code that uses PyTuple_GET_SIZE(), for example, once that macro translates into
((PyTupleObject*)obj)->ob_size

> Anyway, is there code that expects Py_SIZE() to be fast and allow 
> PyList_GET_ITEM to be very expensive?

I agree that quickly accessing the size is dwarfed by the comparison to
accessing the items - I consider it a nice side effect, not the ultimate
performance booster.

The real problem I see is the potential change in behaviour for non-builtins.

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1122>
________________________________________


More information about the pypy-issue mailing list