This is something that I have heard many times without ever
being really convinced. To me multiplication takes (well at least two
or three years ago) at least four clock cycles whereas addition or
memory accesses take 1. This is/was quite general.
Of course, this is true only if the memory block is in the cache but
one could expect this to be true as the vector of pointers will be
accessed each time a array element is read or written.
On the other hand, I have seen an argument about aliasing problems
introduced by the vector of pointer technique that was reasonnably
convincing even thought I'm not quite sure that if it is related to
compilers or to the standard for C and C++ (for example egcs alias
analysis improved quite a lot recently at the only cost of forbidding
thing like * (int *) &d = 1234; where d is a double).
Obviously this may vary with compilers and processors...
Does anyone have more insight in the problem ?
Sorry, all this is slightly out of the topic of the mailing list...
Theo.
--------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
--------------------------------------------------------------------