help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] OrderedCollection growing


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] OrderedCollection growing
Date: Sat, 25 Jun 2011 13:54:46 +0200

On Fri, Jun 24, 2011 at 13:57, Gwenaël Casaccio <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]