[Cython] PATCH: removing strcmp() in favor of custom impl or other fixes
Stefan Behnel
stefan_ml at behnel.de
Sat Mar 7 21:39:17 CET 2009
Lisandro Dalcin wrote:
> On Sat, Mar 7, 2009 at 4:47 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
>> Note that I already used (almost) the same optimisation in the code, which
>> now becomes superfluous. Although I expect it to be a lot faster to check
>> the length inside the loop before calling into the Python's C-API, these
>> checks should be rare enough to just make that
>>
>> if (_PyString_Eq(**name, key)) ...
>
> OK. I did not give a full review of that part of the code. So then
> this _PyString_Eq() call will unlikely be ever made, right?
Yes. The most common cases are handled directly inside the function's own
init code, so it's unlikely already that this function will be called in a
time critical context. Then, most keyword names are inlined, so the
fast-path at the beginning of the loop body will hit. If it does not, it's
either the rare case that a non-inlined keyword name was passed, or one of
the possible error cases. None of these it performance critical.
Stefan
More information about the Cython-dev
mailing list