Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I print out the number of keys for all cases when the total number of buckets doubles. I use version 5.10.0. Initial part of the output is:$old_total_bucket = 8; $size = 0; for ($i = 0; $i < 65537 ; $i++ ) { $size++; $words{"$i"} = 1; $c = %words; ($fill_bucket,$total_bucket) = split(/\//,$c); if($total_bucket != $old_total_bucket) { $old_total_bucket = $total_bucket; print "For the $size keys, hash parameters are: $c \n"; } }
For the 9 keys, hash parameters are: 8/16
For the 16 keys, hash parameters are: 15/32
For the 33 keys, hash parameters are: 29/64
For the 64 keys, hash parameters are: 53/128
So this seems to indicate that doubling occurs when "the number of keys exceeds the number of buckets". However, the output of my script shows that could be some other criterion involved. So when does Perl double the number of buckets in hash? Thanks a lot for any suggestions!} else if (xhv->xhv_keys > (IV)xhv->xhv_max) { hsplit(hv);
|
|---|