Earlier quoted context omitted.
> This is just as cumbersome in the array-of-structs case: some structs are larger than others in the same array, you need some signalling mechanism to know which structs are and aren't Point3Ds Strong disagree. The traditional OOP approach is passing indirect pointers to everything and incurring an inefficient level of indirection. Ex: vector blah; blah.push_back(&somePoint2D); blah.push_back(&somePoint3D.xy); foo(b…
Right, but your example isn't an array of structs anymore. It's an array of pointers. You are correct that it's easier to take an array of structs and turn it into an array of pointers, or to take a single struct and get a pointer to one of it's members, whereas a struct of arrays would have to be scattered in order to get anything referenceable. ISPC sounds pretty cool. How much of a performance penalty is scatter/g…
It should also be noted that in ISPC, CUDA, ROCm, OpenCL (etc. etc.), your thread-local variables are compiled into SOA form for maximum performance.
SIMD architectures benefit more from SOA, and as such... making maximum use of SOA is built into those languages implicitly. If you're finding yourself reaching for SIMD-techniques, maybe its time to use a dedicated SIMD-language.