I am trying to optimize such things in a heavy computer application:
Let's say i have
double d[500][500][500][500];
and the following, at least from the point of view of the compiler, is quite expensive
double d[x][y][j][k]
I want to say that the compiler is continuous memory in order to facilitate the offset calculation.
In my example
I have something like this:
double n=0;
for (int i=0; i < someNumber; i++)
{
n+=d[x][i][j][k] ;
}
So I tried to optimize it by putting it in a separate function
void func( double*** const restrict dMatrix )
{
}
did not help: (
Any suggestions for optimizing it?
}
Edit
I cannot rewrite the code to make the array one-dimensional. I need to work with this multi-dimensional beast :(
source
share