[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bitmaps vs Lists



I have a few questions for all you Go programmers:

Do you use bitmap or list type structures in "objects" (term used loosely)
to represent strings, blocks, liberties lists, etc?

I am wondering if board evaluation using linked-lists is faster than using
bitmaps. Just by using bitwise operations (i.e.., OR, AND, XOR and NOT) on a
bitmaps, it is relatively easy to implement the merging of two (or more)
strings after being connected by stone; along with maintaining a bitmap of
liberties. However, I have found that many of my algorithms have to count
the number of bits set in the bitmap (i.e., in recalculating each remaining
string's liberty count after an opponent's string is captured) or have to
convert a bitmap into a list for some non-trivial operations. These types of
operations generally take a fixed about of time to execute. However, the
time to traverse a list is, instead, dependent on the size of the list. So
it could be faster in many cases. Since I have to create lists and count
bits so much, I'm thinking about scrapping my bitmap representations almost
entirely. Is this a good move or should I stick to what I got? (I'm not
particularly concerned about using bitmaps for pattern matching; I have a
few ideas on how to quickly get a few hash values from a list-structure to
efficiently prune a database search - but that's another topic).

David, in Many Faces of Go, I remember you stating a long time ago that you
used linked-lists rather than bitmaps. Is that still the case?

Thanks in advance,

Phil