On Mon, 27 Dec 2004 16:36:38 -0800, Palit, Nilanjan <[EMAIL PROTECTED]> wrote: > I wanted to know if there are any limitations to the max key length used > for hashes in Perl. Also, what are the performance implications, if any, > of using long keys? I have an application that needs key lengths in the > range of ~1000, but with relatively limited numbers of keys (few to low > tens of thousands).
There is no upper limit beyond access to RAM. The performance implication is that computing a hash value takes time proportionate to the length of the key. So doing a hash lookup for a key of length 1000 could be up to 100 times slower than doing a hash lookup for a key of length 10. (It won't actually be 100 times as slow because there are other steps which take the same time, but without benchmarking it I don't know what the likely time is.) As always, the average time to access an element in a hash should be independent of the number of keys that you have. Cheers, Ben _______________________________________________ Boston-pm mailing list [email protected] http://mail.pm.org/mailman/listinfo/boston-pm

