IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Even if only once....
if you're looking in an array (for an exact match), you probably want the hash.
Collapse Edited by Simon_Jester March 30, 2005, 04:39:38 PM EST
Even if more than once....
if you're looking in an array (for an exact match), you probably want the hash.
New Only if you're going to repeat the operation a few times
Building a hash is slower than scanning the array.

Accessing a hash many times is faster than scanning the array many times.

At some fairly small fixed number, building the hash is worthwhile. That number varies with OS, version of Perl, and what parameters Perl was built with. I tested it once at 7, but that is probably not true any more.

Cheers,
Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)
     Things in lists'n'stuff. - (pwhysall) - (3)
         Re: Things in lists'n'stuff. - (dws) - (2)
             Even if only once.... - (Simon_Jester) - (1)
                 Only if you're going to repeat the operation a few times - (ben_tilly)

We'll all still go there on holiday, get the shits, and complain about their hilariously bad plumbing.
35 ms