Original Post
Hi all,
I have 4 nested loops in a C++ function such that there are 125,000 total iterations. In the innermost loop I do a simple write to a float array[5], i.e.
This code is part of a larger 3D test. If I comment out the "array[ctr] = v;" line, I get 600fps, if not I lose over 200fps and drop down to ~350 fps. Could this be due to CPU cache issues? I'm really stumped on this one, thanks for any help.
I have 4 nested loops in a C++ function such that there are 125,000 total iterations. In the innermost loop I do a simple write to a float array[5], i.e.
float array[5];
for (uint a = 0; a < 1000; a++)
{
for (uint b = 0; b < 5; ++b)
{
for (uint c = 0; c < 5; ++b)
{
for (uint d = 0; d < 5; ++b)
{
unsigned int ctr = 0;
float v = 23 * a * b;
array[ctr] = v;
}
}
}
}
This code is part of a larger 3D test. If I comment out the "array[ctr] = v;" line, I get 600fps, if not I lose over 200fps and drop down to ~350 fps. Could this be due to CPU cache issues? I'm really stumped on this one, thanks for any help.