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.
Expand Edited by Simon_Jester March 30, 2005, 04:39:38 PM EST
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)

Reese's Pieces? Am I in a different pit this time?
92 ms