Re: OONSTD: Element Ordering 2D Arrays

Roldan Pozo (pozo@nist.gov)
Thu, 09 Jul 1998 11:22:09 -0400

Jim Phillips wrote:

> On Thu, 9 Jul 1998, Roldan Pozo wrote:
>
> > If you are concerned with efficiency (I am) add one precomputed M-length
> > vector of pointers (at timeof construction) to avoid any runtime overhead.
>
> Wouldn't the extra memory access take far longer than a multiply?
> Especially since the array pointer and N would be adjacent in memory
> (since they are in the same object) while the vector of pointers would be
> dynamically allocated?

Actually, the A[i] part of A[i][j] is a constant subexpression which is
optimized out of inner-loops, so this becomes a non-issue. However,
performance measurements show that integer multiply is often slower
(particularly on Intel architectures.).

--Roldan