I created a handful of tools for bit manipulation (several bitset classes with varying size and performance and some macros). Now that I seem to be complete for starting the first little memoization system test for the system I described before. Too bad I need to change all the bit shifting when I want to port it to a system with another endian mode. Anyway! The bitset (or bitfield, whatever you'd want to call it) is for manipulating bits like you'd manipulate them in an array. I'm aware of the fact that my what I'm planning to create could make a shitload of data (though not a moderate amount compared to what nowadays video games consume). So it is wise (in terms of memory consumption) to not save space-wasting booleans but work with bits instead. Since I can only use power of two bitsizes for my idea, it is not a problem to stick with a single long int variable (atleast 32 bits on most systems). However, I can also use a multiple of 32 bit or 16 bit or 8 or whatever - it only differs in the number of operations to perform. Though 32 entries for a memoization array is really small, I can still rewrite with not much effort in any case thanks to my consistent class design (sometimes I like to fondle my ego).

If everything works correctly, I can use a minimum of memory consumption for each memoization array. Although it'd be faster to not always seperate the bits, check for it's state and thus knowing if the entry has been memoized, I'm more concerned about the memory it would consume, since I do know that I'll never check for anything else than for a single bit beeing set. Let's think about... 32^3 entries in worst case, a T-typed data value and a pointer for detail data as base memory. That's already 256 MB of data for a float array with a lot of details. And you also need 32^3 bytes for the bool variables - 32 MB more! With a single bitset array it'd be only 4 MB you can splitup in an appropriate number of bytes. So really a minimum of space required in this case. But well, I don't think I'd need so many entries in reallife, atleast I hope so. If my concept doesn't work, I can use the memoization mechanic for other purposes (and equal speed). Well, I hope it works. The idea is conceptually too nice to be worthless.

No comments: