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 <[EMAIL PROTECTED]> Date: Sunday, Aug 17, 2008 6:55 am Subject: [Cython] Boundchecking question To: Cython-dev <[email protected]>Reply-To: [email protected] 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 >[email protected] >http://codespeak.net/mailman/listinfo/cython-dev > _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
