Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Uniform distribution of keys in the buckets

by Anonymous Monk
on Mar 29, 2002 at 14:45 UTC ( #155251=note: print w/replies, xml ) Need Help??

in reply to Re: Re: (Ovid) Re: Comparing two hash tables
in thread Comparing two hash tables

So how can i ensure whether the distribution of keys in the buckets is uniform or not ? Please suggest Thanks
  • Comment on Uniform distribution of keys in the buckets

Replies are listed 'Best First'.
Re: Uniform distribution of keys in the buckets
by jmcnamara (Monsignor) on Mar 29, 2002 at 15:21 UTC

    The following will give you some information about the hashing:     print scalar %hash;
    See perldata for information: search for "bucket":

    This is pretty much useful only to find out whether Perl's internal hashing algorithm is performing poorly on your data set. For example, you stick 10,000 things in a hash, but evaluating %HASH in scalar context reveals `"1/16"', which means only one out of sixteen buckets has been touched, and presumably contains all 10,000 of your items. This isn't supposed to happen.

    However, this probably won't help you because you have no control over the hashing mechanism.

    Ultimately, the only way for you to answer your question is to use Benchmark.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://155251]
[LanX]: greetings from Singapore

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2017-02-21 06:04 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (307 votes). Check out past polls.