Java memory efficiency and column-oriented data
bearophile
bearophileHUGS at lycos.com
Thu Feb 2 18:38:43 PST 2012
Marco Leise:
> From the back of my head I remember thinking of this. I'm not sure if I
> really needed it, or just split up the struct in two parts.
Splitting up a struct Foo is possible, but then when you have to pass it around you need to remember to pass all its parts. And things gets more complex if Foo has various methods that use mixed subsets of the fields.
Column-wide arrays allow you to not change the original Foo struct, to use Foo unchanged where you don't need a column-oriented data structure, and allow you most common usages. They allow you to split your Foo in different ways in different parts of your program, using different ParallelArray. They are supposed to give higher scan performance if in a part of a program you need only a subset of the fields. Iterating only on a subset of the fields of an array of records is a common enough task in my D code.
Bye,
bearophile
More information about the Digitalmars-d
mailing list