[erlang-questions] Warning: erlang:phash2 output
Paulo Sérgio Almeida
psa@REDACTED
Thu May 7 16:49:38 CEST 2009
Bjorn Gustavsson wrote:
> Actually, it produces good hash values for any term *except* atoms.
More good news. Now I can avoid doing a term_to_binary, and get around
twice the speed for common small terms.
Thanks Bjorn,
/psa
>
> If you have term that contains atoms (e.g. atoms in a list or tuple), you
> will probably get a decent hash value anyway because the hash for
> the atoms is mixed into the hash value calculated by the list or the
> tuple.
>
> Try:
>
> erlang:phash2([a]).
> erlang:phash2([b]).
> erlang:phash2([c]).
>
> /Bjorn
More information about the erlang-questions
mailing list