Absolutely horrible default string hashing

dsimcha dsimcha at yahoo.com
Sat May 2 11:48:34 PDT 2009

== Quote from bearophile (bearophileHUGS at lycos.com)'s article
> dsimcha:
> > we first need to fix D's string hashing.<
> Ages ago I did suggest this one in the main D newsgroup:
> http://www.azillionmonkeys.com/qed/hash.html
> Bye,
> bearophile

On second thought...The real problem is just a strange bug in D's RTTI.
(cast(void*) typeid(immutable(char)[])) != (cast(void*) typeid(char[])).  If one
uses the typeinfo for char[] instead of that for immutable(char)[], then the hash
performance is actually good, around 96k unique hashes.

More information about the Digitalmars-d mailing list