Strings hash value memoized

bearophile bearophileHUGS at lycos.com
Sat Jul 12 05:51:56 PDT 2008


Jarrett Billingsley:
> Or, you store the precomputed hash in the structure (i.e. AA) that uses 
> them.  Which is exactly what the default AA implementation does, actually.

Having the hash value in the string has some advantages, if have two strings and both of them have their hash value is already computed, you have a way to test quickly if they are different. You can compute intersection and union between two string sets quickly. If the same string is in more AAs/sets you compute and store its hash value only once for its life.

Bye,
bearophile



More information about the Digitalmars-d mailing list