On Mon, Mar 2, 2009 at 12:22 PM, Nicholas Clark <n...@ccl4.org> wrote: > On Mon, Mar 02, 2009 at 10:23:38AM -0800, Bill Ward wrote: > >> Personally I always use hashes for objects. Hashes are pretty fast in Perl, >> especially when there aren't many keys, so I don't think the benefits of >> using arrays are worth it. The risk of typos is pretty small, and the > > Hash lookup should be O(1), independent of number of keys. Of course, a hash > with more keys uses more memory, but so does an array with more elements.
I once found some very fast code varying in something I'm guessing was O(n) on the length of the keys. I've occasionally wished I could get static lookups to compile with the hashed I32 already stashed. Josh