The dict object is divided into two elements. entry and index. The entry is an array of [hash value, key, value], and the index is the hash table itself, which contains numerical values. \ [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1](initial value) ↓ \ [-1, -1, -1, -1, -1, 0, -1, -1, -1, -1](there is one) ↓ \ [-1, -1, -1, -1, -1, 0, -1, -1, 1, -1](there is a second one) ↓ \ [-1, -1, -1, -1, -1, -2, -1, -1, 1, -1](Erase the first key)
It seems to behave like this. If you erase the value once entered, it becomes -2.
The minimum size of the hash table is 8. Of course, this table will be resized if it gets too full. The index type changes depending on the table size. When the table size is 128 or less, it becomes int8, when it is 2 ^ 15 or less, it becomes int16, when it is 2 ^ 31 or less, it becomes int32, and when it is larger, it becomes int64.
Recommended Posts