Absolutely horrible default string hashing

Jarrett Billingsley jarrett.billingsley at gmail.com
Sat May 2 11:43:09 PDT 2009


On Sat, May 2, 2009 at 1:00 PM, dsimcha <dsimcha at yahoo.com> wrote:

> The result is that only about 8400 unique hashes are used, meaning 90+ % of
> keys cannot be stored directly in the position corresponding to their hash.
> Note that this is in full hash_t space, not in the modulus space typically
> used for AAs, so the real results are probably even worse.  If the hashes were
> uniformly distributed across all possible values of hash_t, one only would
> expect about 30 collisions, meaning about 99970 unique hashes.  (This is based
> on monte carlo, not exact combinatorics, so it's only a rough figure, but it
> doesn't really matter for the take-home message anyhow.)

Here's something bizarre: porting this example to Tango yields 99997
unique hashes, which is right in line with your estimate.  But I think
it's bizarre since, well, shouldn't druntime use _the same typeinfo
code?_



More information about the Digitalmars-d mailing list