[lug] Hash vs list
jeff at zingstudios.net
Mon Apr 24 16:02:04 MDT 2006
Tkil, et al:
> And the general answer is: "it depends"...
Thanks for the responses, everyone. Some were far more detailed than I
really needed, but they gave me a lot of insight into how these sorts
of things work. (To answer your comments, Tkil, I'm doing a lot of
searching... so the up-front cost of building a data structure is
In the end, I wrote some test programs and ran them against generated
data, and the hashes won the speed test hands-down. It seems a little
odd to use a hash when all I really have is a huge set of "keys" (I set
the values to 1 arbitrarily) but it's clear the hash-key lookup is
vastly more efficient than iterating over a huge array.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 191 bytes
Desc: not available
More information about the LUG