Alternative to Java Bitset with array like performance?
问题 I am looking for an alternative to Java Bitset implementation. I am implementing a high performance algorithm and seems like using a Bitset object is killing its performance. Any ideas? 回答1: Someone here has compared boolean[] to BitSet and concluded with: BitSet is more memory efficient than boolean[] except for very small sizes. Each boolean in the array takes a byte. The numbers from runtime.freeMemory() are a bit muddled for BitSet , but less. boolean[] is more CPU efficient except for