Home > Back-end >  The capacity expansion mechanism why the initial value is 16, can custom into 15, why must be expone
The capacity expansion mechanism why the initial value is 16, can custom into 15, why must be expone

Time:01-01

CodePudding user response:

Written power of 2 computers do displacement budget is faster, should be like this

CodePudding user response:

You can set up 15, but the actual will be converted into 16, you can take a look at the source tableSizeFor () method, in this way you will be set by displacement capacity - 1 operation into the closest next 2 n times the power, set to 2 NTH power is mainly in order to quickly locate on the slot array, 2 n - 1 binary will make the current capacity of low all into 1, again with hahs value & amp; Operation can get slot array, different from modulus calculation, the modulus can set any value, but not modulus operation efficiency & amp; High operation