in reply to Re: Re: print scalar %hash... erm
in thread print scalar %hash... erm
When you want to do something with a specific key, you call the hash function for that key, use the result to find the appropriate bucket, and then search all the items in that bucket for the one you want. So, instead of having to check against every item in the hash, you only have to check against a few items that happen to be in the same bucket.
As you keep adding to the hash, each bucket has to hold more items. As the buckets get bigger, the lookups get slower, because you have to search through more items. That problem is solved by dynamically increasing the number of buckets and redistributing the items as the hash grows in size.
Your hash has 64 buckets (Perl always uses a power of 2), although only 42 are being used to store the 53 items. That just means that, with that combination of hash function, number of buckets, and keys, a few of the keys are sharing buckets.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: print scalar %hash... erm
by larryk (Friar) on May 24, 2001 at 23:18 UTC | |
by pileswasp (Monk) on May 25, 2001 at 00:21 UTC | |
by chipmunk (Parson) on May 25, 2001 at 04:59 UTC | |
by tye (Sage) on May 25, 2001 at 05:03 UTC | |
by larryk (Friar) on May 25, 2001 at 13:37 UTC | |
by tye (Sage) on May 26, 2001 at 00:54 UTC |