On Thu, Oct 22, 2009 at 5:22 AM, Stefan Behnel <[email protected]> wrote: > > Robert Bradshaw wrote: >> On Oct 21, 2009, at 9:56 AM, Lisandro Dalcin wrote: >>> OK, patch uploaded: >>> http://trac.cython.org/cython_trac/attachment/ticket/417/typetest.diff >>> >>> Please review, and let me know if it is good enough for pushing... >> >> I'd either make the function inline or split it up into two functions >> so that the none_allowed argument (and possibly check for none) can be >> eliminated at compile time. > > +1 for an inline utility function, although splitting it might still be a > good idea. > > I'd also keep the "== Py_None" test first then, as this is something the C > compiler can either know or that the CPU can quickly execute, faster than > the following type check which requires at least an indirection, or even a > function call (so the C compiler can't reverse the two tests due to > potential side effects). >
OK, many thanks for your input... I acknowledge the code in my patch is a crap, but I've just followed naming and implementation conventions for the argument type test code (just to not break the rules). BTW, I think the arg type test should also be improved, or perhaps even merged with this one we are talking about. I'll rework the patch. -- 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 [email protected] http://codespeak.net/mailman/listinfo/cython-dev
