[fpc-pascal] THashedStringList vs TFPHashTable
Dean Zobec
dezobec at tin.it
Thu Sep 28 05:12:40 CEST 2006
Graeme Geldenhuys ha scritto:
> Thanks to all that replied. The string that is going to be stored in
> the List (with associated object) is a GUID string, so is very random
> by nature. Would this have any negative affects in the hash table?
>
> I will try it out anyway, I can always swap the internal list out if
> needed. What I am creating is a Flyweight (design pattern) to store
> all common objecs I use. I will be fetching the objects based on the
> OID (GUID) string.
It's a typical use. Choose an appropriate HashTableSize when creating
the container (approx.the number of the elements you are going to store
or more), you can test it with different hash functions and see through
the statistics which one is better (the longer the chains i.e. more void
slots, the longer the fetch times).
Dean
More information about the fpc-pascal
mailing list