[Cython] Boundchecking question
Dag Sverre Seljebotn
dagss at student.matnat.uio.no
Sun Aug 17 09:58:00 CEST 2008
ah, arithmetic on the indices. Yes, that is a bit inconvenient.
Another thing you could try in your tests is tuning branch prediction (unlikely(...))..
Dag Sverre Seljebotn
-----Original Message-----
From: "Dag Sverre Seljebotn" <dagss at student.matnat.uio.no>
Date: Sunday, Aug 17, 2008 9:26 am
Subject: Re: [Cython] Boundchecking question
To: <cython-dev at codespeak.net>Reply-To: cython-dev at codespeak.net
I'm not sure what you mean -- a negative bound is only checked for once per dimension. I.e. Positive ints are only checked for negativity once per dim.
>
>(Remember that one must also check for the negative bound, i.e. -n, but this is only done for negative numbers).
>
>There is potential for optimizing the exceptional case when bounds are off (but the code would be a little less clean and exceptional cases are just that).
>
>Could you perhaps post some C code modified as you suggest?
>
>Finally, if what you propose is a change in semantics, then this already met resistance on the numpy list. Perhaps a buffer-unsigned-indices-only compiler directive.
>
>(However I think that it is possible to write your code using unsigneds so that you use unsigned everywhere instead of signed, and then this comes automatically...)
>
>I don't care too much about constants, they're not likely to be used in performance critical code I think.
>
>Dag Sverre Seljebotn
>-----Original Message-----
>From: Robert Bradshaw <robertwb at math.washington.edu>
>Date: Sunday, Aug 17, 2008 6:55 am
>Subject: [Cython] Boundchecking question
>To: Cython-dev <cython-dev at codespeak.net>Reply-To: cython-dev at codespeak.net
>
>I've been playing with the (very cool!) buffer stuff Dag did getting
>ready for the SciPy conference. I've seen a 20% increase in speed not
>adjusting for negative indices, but making sure the indices are
>unsigned is a pain (especially if there is arithmetic involved). One
>proposal that has been brought up is to make positive integer
>constants unsigned, which could lead to complications elsewhere and
>would still require care. Another proposal that I'd like to throw out
>there is to have negative index realigning part of bounds checking,
>i.e. negative indices are not checked for if bounds checking is off.
>
>>Thoughts?
>
>>- Robert
>
>>_______________________________________________
>Cython-dev mailing list
>Cython-dev at codespeak.net
>http://codespeak.net/mailman/listinfo/cython-dev
>
>
>_______________________________________________
>Cython-dev mailing list
>Cython-dev at codespeak.net
>http://codespeak.net/mailman/listinfo/cython-dev
>
More information about the Cython-dev
mailing list