[Numpy-discussion] iterator speed

Neal Becker ndbecker2@gmail....
Sun Dec 30 09:02:13 CST 2007


In numpybook, in discussing iterators, it says that if you know your array
is contiguous, it may be faster to just use C-style pointers instead of
iterators.

Looking at the code a little, it appears that PyArray_ITER_NEXT(it) attempts
to optimize for certain cases.  I wonder if anyone has done any benchmarks
on modern compilers?

In particular, I'm hoping that PyArray_ITER_NEXT on a modern compiler will
optimize the contiguous case to give equivalent performance to a c-style
pointer.  In that case, I could happily use the generic iterator without a
speed penalty.



More information about the Numpy-discussion mailing list