What is ....
Kurt Wall
kwall
Thu Feb 9 22:11:21 PST 2006
On Thu, Feb 09, 2006 at 07:55:55AM -0600, Ben Duncan took 49 lines to write:
> Ok, thanks everyone. The reason I asked is DBM stuff I am
> copying from, often to refer to bit-mappin' the index (WTFIT?) and
> using a bit-map for telling what "fields" are indices.
>
> I can see the usage from when disk space was a premium (Kinda like the
> old COMP-3 stuff in Cobol), but as another question:
>
> Now that we have HUGE disk drives, would it not be as feasible to simply
> use short unsigned int in an array configuration to do the same?
It's not about disk space consumption, but speedy access to frequently
used data, cache locality, and the cost of cache misses versus cache
hits. Logical ORs and ANDs map directly to CPU instructions, so they're
going to be fast. Packing more information into a variable lets you
refer to data in L1 cache without having to go out to L2, L3 or RAM,
or, heaven forbid, disk or swap.
> I am just looking to figure out the best way to:
>
> A; Keep the code base maintainable by all walks of programming
> Life Forms ( ;-> )
Bitmaps are easy and a standard part of the C idiom.
> B: Make it efficient and reasonably fast
Bitmaps are very fast.
> C: Apply the K.I.S.S. principal ...
Bitmaps are simple.
Kurt
--
As long as the answer is right, who cares if the question is wrong?
More information about the Linux-users
mailing list