Is array of int3 gives performance improvement?

Hi All,

I read in SDK pdf that instead of using AoS use SoA.
int3 and alike built-in vector type is in reality is a structure .So, does using array of that built-in type give performance improvement ?

I have the same question, i.e.

is

a = myfloats[idx].x
b = myfloats[idx].y
c = myfloats[idx].z

faster than

a = myfloats1[idx]
b = myfloats2[idx]
c = myfloats3[idx]

?

Actually I have a structure and I have to its array of size 800. So, I need to organize struct such that it can excess efficiently. My original struct is

struct dump

{

	int *a1;

	int * a2;

	int *a3;

};

I think two ways of writing this:

first one

Second one

Which Way is more efficient?

when using global memory, you should consider about the coherence in reading and writing.

if the total number of elements in myfloats is a multiple of 4. your second option is faster.

your first option, you can not get coherence in reading and writing to global memory, so in reading and writing (from/to global memory) it wastes you alot of time.

First one is structure of array. and second one is array of structure.

the first one is efficient.

to get the high performance, please consider the number of elements in your array.