string hash significant speedup

Johnson Jones via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 10 12:36:32 PDT 2017


when using T[string], hashing is used. Computing the hash is 
slow(relatively speaking).

Does D cache the hashes? Strings are immutable so there is 
absolutely no reason why the hash ever need to be computed more 
than once.

Essentially the hash should be attached to strings like their 
length and address.

Does D compute the hash of a string every time it is looked up? 
If so, any way to optimize that it?


More information about the Digitalmars-d-learn mailing list