Bit subscriptions, RAM columnwise layouts
BCS
ao at pathlink.com
Thu Dec 11 17:00:09 PST 2008
Reply to bearophile,
> 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 :-)
>
I've got to run off now but my current sticking point is getting from Struct.tupleof
to a tuple of members names and then passing that tuple on to other templates.
My first few tries kept going odd.
Want to try? go ahead.
> 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?
>
yup foreach will take a delegate of the correct form for the RHS or just
return the array its self.
> 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