in reply to An array of boolean values in a bitfield

This is what vec is for. I found the memory savings very useful in handling several of the Project Euler problems. However I found that if I needed to access all of the bits multiple times, and wasn't running out of memory, then the traditional array was faster.

Random tip. The value undef is less than half the size of an empty string and works just as well in the traditional array approach. It is still a memory hog, but the difference can be significant if you're near your memory limit and you don't want to go to using vec yet.

  • Comment on Re: An array of boolean values in a bitfield