[Cython] dict set value
Greg Ewing
greg.ewing at canterbury.ac.nz
Fri Sep 5 06:07:55 CEST 2008
Robert Bradshaw wrote:
>> it still generates inefficient code via PyObject, not via PyDict_SetItem:
>>
>> PyObject_SetItem(((PyObject *)__pyx_v_1a_a), __pyx_kp_1, __pyx_int_1)
Keep in mind that the difference in efficiency is very small,
since there is a direct path from PyObject_SetItem via the
object's mp_setitem slot to the relevant C function. There
isn't even any type test involved.
The type-dependent optimisations which are implemented are
more significant, since they avoid type tests, method
lookups and/or conversion between C and Python data.
--
Greg
More information about the Cython-dev
mailing list