lately I've seen a piece of code out of a famous scientific article, which is known for its fastness. In it the author always uses temporary variables to restrict access to array elements to a minimum. For example in a inner loop for a recurrent formula he uses:
... real :: temp real :: p(:) ... do i=2,m temp=foo(temp) ... some read access to 'temp' for other variables... p(i)=temp end do ...
I personally would prefer: