[lug] Hash vs list

Jeff Schroeder 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 
worthwhile.)

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.

Thanks again.

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20060424/2c5590ee/attachment.pgp>


More information about the LUG mailing list