[Cython] About IndexNode and unicode[index]

Robert Bradshaw robertwb at gmail.com
Fri Mar 1 09:25:15 CET 2013


On Thu, Feb 28, 2013 at 10:54 PM, Zaur Shibzukhov <szport at gmail.com> wrote:
>>>>
>>>> I think you could even pass in two flags, one for wraparound and one for
>>>> boundscheck, and then just evaluate them appropriately in the existing "if"
>>>> tests above. That should allow both features to be supported independently
>>>> in a fast way.
>>>>
>>> Intresting, could C compilers in optimization mode to eliminate unused
>>> evaluation path in nested if statements with constant conditional
>>> expressions?
>>
>> They'd be worthless if they didn't do that. (Even Cython does it, BTW.)
>>
> Then it can simplify writing utility code in order to support
> different optimization flags in other cases too.

The one thing you don't have much control over is whether the C
compiler will actually inline the function (CYTHON_INLINE is just a
hint). In particular, it may decide the function is too large to
inline before realizing how small it would become given the constant
arguments. I'm actually not sure how much of a problem this is in
practice...

- Robert


More information about the cython-devel mailing list