Data layout optimization arranges data members within memory to enhance
software performance. Profiling data is consulted to determine how to
group data members for an object class into groups. One technique groups
the data members based on how frequently the data members are referenced
in memory. Another technique groups the data members based on their
affinities for one another in time as determined by observing when
references to the data members take place. A variety of options when
collecting the profiling data and grouping the data members is supported.
The data member grouping is recorded in metadata associated with a
definition of the object class. At runtime, a class loader places the
data members of an object in memory according to the metadata. Data
members of different groups can be placed in separately-loadable units of
memory in the memory system. Subsequently, when the data members are
referenced in memory, more frequently referenced data members, including
those that tend to be referenced at times close to each other, reside at
neighboring locations in the memory system.