Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: fastest way to compare two arrays

by roboticus (Canon)
on Apr 14, 2011 at 15:23 UTC ( #899460=note: print w/ replies, xml ) Need Help??


in reply to fastest way to compare two arrays

krusty:

Two questions:

  1. Do you really need to use an array?
  2. Do you really need the lowest-numbered available port?

If the answer is no for both, you might consider using a hash to hold your free ports. So when you want to use a free port, just grab the first available one without sorting, and remove it from the "available" hash. When you're done with it, just return it to the hash.

If you must use an array, but don't need the lowest-numbered port, then just pop a port from your list, and when you're done with it, push it back on.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


Comment on Re: fastest way to compare two arrays

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2014-10-21 05:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (96 votes), past polls