On Wed, Jun 15, 2011 at 11:01 PM, Allen Firstenberg <[email protected]> wrote: >> Please do. Though, keeping a list of free ports might not be optimal >> if the list is long (i.e. a big span of allowed ports). > > It depends what you mean by "optimal". In some rough tests I did, time to > create a PassivePorts object is roughly the same between the two schemes, > although time to allocate all 65535 possible ports is 2-3 times slower under > the old scheme. Memory is the opposite - my proposed scheme uses 3-4 times > the amount of memory the old scheme uses, mostly because of the need to > allocate the Integer objects. An implementation that used ints instead of > Integers could probably get the memory size to be roughly the same.
Let's not worry about this prematurely. When you're done, let's have a look at the code instead. /niklas
