On Sat, Mar 7, 2009 at 4:47 PM, Stefan Behnel <stefan...@behnel.de> wrote:
>
> Since it's never used for anything but string equality checks, it would be
> better to restrict it to that (i.e. 1/0), instead of using the normal
> strcmp() -1,0,1 return values and additionally checking for "== 0"
> everywhere in the code. Maybe call it "__Pyx_StrEqual()".
>

OK. At first, I was going to impement it like that, but changed my
mind (for no good reason) in the process.

+1.

>
> 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?

> The real fast-path is the loop with plain string pointer equality checks
> before all that. (BTW, note that this function is only available in Py2, so
> it's perfectly ok to use it here but not in general).
>

Of couse. I've decided to use _PyString_Eq() just because you had
already special-cased Python major version.




-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to