Bit subscriptions, RAM columnwise layouts

bearophile bearophileHUGS at lycos.com
Thu Dec 11 16:20:04 PST 2008


BCS:
>I'm going to need to wright a column struct array template that takes a struct and stripes the columns.<

If you like my help, I may want to help you :-)

Two things I'd like to see in such struct array template:
1) It has to define one different foreach for each field. So you can iterate just one field. (or a small group of fields, see the memory layout C at the bottom of this post). I don't know yet how this can be done, but I thin it's doable. Do you have ideas?
2) A template boolean constant (that is given at compile time, false by default) that when is true activates the collection of some usage statistics (temporal patterns) inside the data structure. So after such test runs the programmer is essentially able to ask this data structure what's the faster memory layout according to the actual usage of a single data structure inside a program, so he/she/shi can ask the data structure to use it.

There are four main possible memory layouts it can use:
A) Normal array of structs.
B) Separated arrays for each field.
C) A mix of the two, that is separated arrays that contain single fields or group few fields that are usually accessed closely. I think this may give to better performance in such situations.
D) There's also the PAX hybrid I have shown in the original post, that is a single array of "blocks", where each block contains several records arranged as separated columns. I am not sure, but there can be situations where this layout may be good.

Bye,
bearophile



More information about the Digitalmars-d mailing list