I'm trying to update some old code of mine. Previously I used a bitfield comprised of the data type char as I had to keep track of sh_int worth of integers. These were used to track a users progress through the system, and there isn't any restraint on the order in which they must proceed through the bitfield.
Now however circumstances have evolved and I must track up to an int worth of integers. Or rather if the users have encounter that particular page in the db. It's easy enough to just up the size of the bitfield. For the save file this makes almost no difference as I use RLE compression to store the bits. However I noticed that with the same amount of users my program is now taking up a much larger amount of memory which is easily attributed to the increased size of the bitfield.Code:char bitfield[4096]; worked nicely for this.
I tinkered with using RLE as linked structures but that actually increased the memory usage and I rather expected it would due to generally short runs of users through linked documents. Unless they were visiting many continues documents.
Ended up being larger than the initial storage space required.Code:struct rlebitfield { int count; bool bit; rlebitfield *next; };
Is there a better way to store large bitfields in memory?