[Python-Dev] speeding up PyObject_GetItem

Mark Dickinson dickinsm at gmail.com
Tue Mar 24 18:45:38 CET 2009


On Tue, Mar 24, 2009 at 3:50 PM, Daniel Stutzbach
<daniel at stutzbachenterprises.com> wrote:
> On Tue, Mar 24, 2009 at 10:13 AM, Mark Dickinson <dickinsm at gmail.com> wrote:
>> Does removing the PyLong_Check call in PyLong_AsSsize_t
>> make any noticeable difference to these timings?
>
> Making no other changes from the trunk, removing the PyLong_Check and NULL
> check from PyLong_AsSsize_t shaves off 4 nanoseconds (or around 4% since the
> trunk is around 100 nanoseconds).

Thanks.  I'd call that a noticeable difference.  I'd be +1 on changing
this particular check to an assert and so disabling it in non-debug builds.
I'd like to bet that the majority of calls to PyLong_AsSsize_t are
internal.

Mark


More information about the Python-Dev mailing list