in some perf critical program (single threaded), if I have arrays of primitive types, and need to access the same index of those more than once in loops.
Should I use tmp variables, or would just constant indirection on the array be better/faster ?
I could imagine also that it is possible that either is the same / is transparently optimised at compile time.
In general access to an array is slower than a temporary because it has 2 additional pieces of overhead
However I would not be changing any code I had today based on that knowledge unless a profiler clearly showed a tight loop to be a significant perf problem in my application. And furthermore showed that changing to a cached local produced a significant perf benefit.