[Cython] [PATCH] Make __Pyx_ArgTypeTest() use "const char*" to suppress warning

Stefan Behnel stefan_ml at behnel.de
Thu Sep 11 13:09:35 CEST 2008


Stefan Behnel wrote:
> Lisandro Dalcin wrote:
>> I do not see any semantic difference in using PyString_FromString() or
>> PyString_InternFromString(). Both calls return a new reference you own
>> and next have to DECREF.
>
> I'm not talking about a semantic difference, the interning itself is just
> more
> overhead, so it's not worth doing unless you know it will be payed for by
> the usage later on.

To stop this discussion from taking a bikeshed planning route, I looked
through the places where we currently use GetAttrString(). With the
possible (!) exception of the C-API import (which can benefit from some
general optimisation, but likely isn't important enough to bother), none
of them is in any way performance critical, so adding the additional
burden of a second dict lookup for interning is in no way rectified by
whatever speedup we get *after* having interned the name that is looked up
here.

Stefan



More information about the Cython-dev mailing list