|
From: | Gwenael Casaccio |
Subject: | Re: [Help-smalltalk] OrderedCollection growing |
Date: | Mon, 04 Jul 2011 12:05:39 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Lightning/1.0b2 Thunderbird/3.1.10 |
On 06/24/2011 12:17 PM, Paolo Bonzini wrote:
On Fri, Jun 24, 2011 at 08:17, Gwenael Casaccio<address@hidden> wrote:Hi, I've made a small change in OrderedCollection in growBy:shift: I use the primitive VMpr_OrderedCollection_replaceFromToWithStartingAt. I guess it should be possible to tweak again a bit the behavior:That's very nice, you could also implement all of #replaceFrom:to:with:startingAt: with the primitive instead? The primitive would be #primReplaceFrom:to:with:startingAt:. Then you don't need a change in #growBy:shift:, I think.
So here is the patch. I've changed OrederedCollection to use #replaceFrom:to:with:startingAt, SortedCollection uses the Smalltalk implementation but for growing I call the primitive. And OrderedSet uses the St implementation.
In addLast or addFirst if we have any free rooms but first is<= 1 or last= n we could move instead of allocating a new collection.Is it really helpful? Paolo
OrderedCollection.patch
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |