Bit subscriptions, RAM columnwise layouts

Bill Baxter wbaxter at gmail.com
Thu Dec 11 12:23:42 PST 2008


On Thu, Dec 11, 2008 at 11:21 PM, bearophile <bearophileHUGS at lycos.com> wrote:
> Wirbel lets you use an integer a little bit like a list of boolean values with the fixed length of 32 or 64. You can used the square brackets to directly address the bits:
>
> a = 0
> a[0] = true
> a[2] = false
> print(a)

Nice idea, that makes a lot of sense.

> DataDraw is a very interesting library for C, it can be used as a RAM-database:
> http://datadraw.sourceforge.net/

> - By default it uses parallel arrays, that is if you create an array of struct-like things, it doesn't actually keep them as an array of structs, but as many arrays of single items. So the programmer doesn't specify how the system lays and uses memory, and usually lets the system do by itself. There is a also syntax to say that some or all fields of such records have to actually be stored closely, this is useful for the less common situations when you need to process more than a field at a time). This often leads to better usage of the cache, and in the end speeds up several programs.

That's kind of interesting too.  There are definitely times I've
flip-flopped back and forth over whether some particular thing should
be an array-of-structures or a structure-of-arrays.  Definitely seems
do-able in D.  You could make it so a Record!(Struct,20) stores
Structs column-wise, or just flip a bit to store them the other way:
Record!(Struct,20,RecordOrientation.Row).

--bb



More information about the Digitalmars-d mailing list