Struct of Arrays are great when you want to SIMD across loop iterations.
That is, if your code is written as a loop that does some calculations with structs, the Struct of Arrays memory layout allows the compiler to calculate multiple iterations of the loop at a time. This is because it is straight forward to turn each access to a number into a load of an entire SIMD vector of them, etc for each subsequent operation.
This vectorization requires @inbounds
to eliminate branches. It may require @simd for
or even @simd ivdep for
to vectorize.
You can check if it has been vectorized with @code_llvm
.