Hi guys,
I saw in BitSet (JDK1.8) that the way to get wordIndex through bitIndex is as follows:
/**
* Given a bit index, return word index containing it.
*/
private static int wordIndex(int bitIndex) {
return bitIndex >> ADDRESS_BITS_PER_WORD;
}
the description of ADDRESS_BITS_PER_WORD is as follows,
/*
* BitSets are packed into arrays of "words." Currently a word is
* a long, which consists of 64 bits, requiring 6 address bits.
* The choice of word size is determined purely by performance concerns.
*/
private final static int ADDRESS_BITS_PER_WORD = 6;
I have doubts about ADDRESS_BITS_PER_WORD = 6. Why choose 6 for performance reasons? Can you tell me the details?