Why did BitSet choose ADDRESS_BITS_PER_WORD=6??

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?

Feb.16,2022

BitSet choose to use long [] to save digits. long is 64-bit, so 6-digit addressing is required. As for performance considerations, it should be said that the number of digits selected by long is longer than that of int, byte and so on, and only relatively low-frequency extended arrays are needed to save the corresponding digits.
should note that this implementation is a simple implementation, and when you need to set a large bit, the previously unused long wastes a lot of space, in which case you need to use a more efficient bit saving scheme.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b745-4d135.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b745-4d135.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?