On 11/23/2012 7:58 AM, Dmitry Olshansky wrote:
anyone with the most basic programming and mathematical knowledge can
write concise code operating on arrays, taking advantage of the
potential speedups while being aware of the pitfalls.
People typically are not aware as long as it seems to work.
As an example, bearophile is an experienced programmer. He just posted two
loops, one using pointers and another using arrays, and was mystified why the
array version was slower. He even posted the assembler output, where it was
pretty obvious (to me, anyway) that he had array bounds checking turned on in
the array version, which will slow it down.
So yes, it's a problem when subtle changes in code can result in significant
slowdowns, and yes, even experienced programmers get caught by that.