Java memory efficiency and column-oriented data

Marco Leise Marco.Leise at
Thu Feb 2 19:22:29 PST 2012

Am 03.02.2012, 03:38 Uhr, schrieb bearophile <bearophileHUGS at>:

> 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

Can you post code, that proves the claim and some figures? Pictures say  
more than thousand words. As long as I think scanning performance will  
hardly be influenced this just complicates things like

	arr[i].x = 1;  // no return by ref possible, so doesn't do what you want


	arr = minimallyInitializedArray!(Foo[])(1_000_000);


-- Marco

More information about the Digitalmars-d mailing list