Home

StructureofArrays

Structure of Arrays (SoA) is a data layout technique used in computer memory organization. In a SoA layout, each field of a data record is stored in its own contiguous array, so that all values of a given field are adjacent in memory. This contrasts with an Array of Structures (AoS), in which each element is a complete record containing all fields.

This layout enables efficient data-parallel processing and improved cache locality when operations target a single field

Trade-offs: SoA often requires more complex code for accessing a complete record, since related fields are stored

Common in performance-critical domains such as graphics, physics engines, simulations, and data-oriented designs; SoA is frequently

Implementation notes: adopting SoA may involve specialized kernels and data structures. A typical example stores attributes

across
many
records.
By
storing,
for
example,
all
positions
or
all
velocities
in
separate
arrays,
vectorized
operations
can
process
many
elements
simultaneously
and
memory
bandwidth
can
be
exploited
more
effectively.
separately.
Additional
arrays
must
be
kept
synchronized
as
elements
are
added
or
removed,
and
some
workloads
may
incur
overhead
when
frequent
access
to
multiple
fields
of
the
same
item
is
needed.
Indexing
tends
to
become
a
two-step
operation:
locate
the
row
in
each
relevant
field
array.
used
in
entity-component-system
(ECS)
architectures.
Libraries
and
frameworks
sometimes
provide
SoA
containers
or
views
to
facilitate
working
with
separated
field
arrays
while
preserving
convenient
abstractions.
like
positions
in
separate
arrays
for
x,
y,
and
z
as
floats;
operations
then
act
on
one
component
array
at
a
time.
Attention
to
memory
alignment
and
compiler
vectorization
opportunities
can
yield
substantial
performance
benefits.