peterc/bitarray — pull request #3 by genehsu (2012-02-20 07:40:08+00:00)
Title: Another day, another implementation

Hello Peter,

I had another idea about using another of ruby's base types, the String type. I have put the Numeric and String implementations under your BitArray class. The String implementation is still slower than your original Array implementation since you use 4 byte increments. I have updated the initializer of your implementation to be correct when the default bit is set to 1 since the total_set will at best accidentally return the correct value, but at worst go into an infinite loop. (~0 >> 1 == ~0). If you want to refactor that, you're welcome to. I also added the simple benchmark I used and added a rake task (bench & benchmark). I hope this is helpful. I think my experiments with this have come to an end, so this will probably be the final pull request. Thank you for your time.

Gene