On Apr 11, 2007, at 6:23 AM, Frank Bitterlich wrote: > Hi, > > I need to maintain an integer array to be used as a FIFO stack. I > will .append() up to 10000 values, and when the array reaches that > size, I will "cut off" the oldest (lowest) 5000 entries. Right now > I'm doing this by using .remove() in a loop. > > The thing needs to be as time-efficient as possible, so I wonder if > it would be more efficient if I created a new array and copied over > the last 5000, rather than removing the first 5000. > > Has anybody experience with this kind of operations, so that I don't > need to test it on my own? >
If it needs to be fast, you should allocate the array in advance and use a stack pointer or two to keep track of the current stack size and the current location. Charles Yeomans _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
