On Fri, Jun 24, 2011 at 13:57, Gwenaël Casaccio <[email protected]> wrote: > I think it can be helpfull consider the situtation: > we have enough room but first <= 1 we cannot decrease (if adding item first) > what happen know a new orderedcollection is allocated and items are moved, > in the new behavior the items are just moved ("less" impact on the gc)
Yes, that's true. Especially if the old collection is in old-space and it keeps old objects alive after they are removed from the OC. But I would limit the number of slots by which you move. In particular, you need to ensure that only the first attempt results in a move, the second should result in a grow. I'm not sure if this is possible, but it would be necessary to avoid quadratic behavior. The problem is that the most common scenario where this helps (a FIFO queue with addFirst: / removeLast) will not result in optimal behavior anyway due to shrinking. Perhaps an alternative approach is this: remove shrinking, and only do the move if the OrderedCollection is at most 33% full, or something like that. WDYT? Paolo _______________________________________________ help-smalltalk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-smalltalk
