Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How do I find the index of a specific array value?

by SM177Y (Initiate)
on Sep 15, 2015 at 08:46 UTC ( [id://1142024]=note: print w/replies, xml ) Need Help??


in reply to How do I find the index of a specific array value?

I also was looking for a method to do this, preferably the fastest possible. With a relatively small array (256), the use List::Util qw(first); method was actually significantly slower than simply iterating through the array and breaking(last) out once the match was found. In my test example on a 2.5MB file doing a sort of Sbox type lookup, the iterating took about 3m45s on my old Atom netbook where as the use List::Util qw(first); method required over 5m. Does anyone know the fastest way to perform these index lookups? A few of the examples shown appear to be basically identical. Hashing an array(did I say that right?) is a concept I am not yet familiar with.

Originally posted as a Categorized Answer.

  • Comment on Re: How do I find the index of a specific array value?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1142024]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-24 10:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found