Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: fastest way to compare two arrays

by roboticus (Chancellor)
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


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.


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

Comment on Re: fastest way to compare two arrays

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (16)
As of 2015-07-30 21:00 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (273 votes), past polls