SoA vs. AoS: Data Locality Showdown

Struct of Arrays (SoA) generally offers better cache performance than Array of Structs (AoS) when processing a single field across many elements, as it reduces cache line loads by keeping related data contiguous. Conversely, AoS can be better if all fields of a single element are frequently accessed together.

Sources

Open the full topic