[squeak-dev] Re: OrderedCollection enhancements

Andreas Raab andreas.raab at gmx.de
Tue May 11 04:35:25 UTC 2010


Looks fine to me. No obvious weaknesses or problems so there's 
relatively little to comment on :-) Unless there's something else you 
want to tweak, go ahead and post it into the trunk.

Cheers,
   - Andreas

On 5/10/2010 6:26 PM, Levente Uzonyi wrote:
> Hi,
>
>
> I recently uploaded to versions of the Collections package to the Inbox
> for review and testing before adding them to the Trunk. These changes
> affect only rare, but important use-cases of OrderedCollection (and it's
> subclasses). After evaluating the following snippet:
>
> Installer squeak
> project: 'inbox';
> install: 'Collections-ul.359.mcz'
>
> from your up-to-date Trunk image, you can expect the following speedups:
>
> "Add elements without growing to the end."
> (1 to: 5) collect: [ :run |
> [
> | o |
> o := OrderedCollection new: 100000.
> 1 to: 100000 do: [ :each | o addLast: each ] ] timeToRun ].
> #old -> #(19 19 20 19 20).
> #new -> #(13 14 14 14 14).
>
> "Add elements without growing to the front."
> (1 to: 5) collect: [ :run |
> [
> | o |
> o := OrderedCollection new: 100000.
> 1 to: 100000 do: [ :each | o addFirst: each ] ] timeToRun ].
> #old -> #(14 14 14 14 14).
> #new -> #(10 11 10 10 10).
>
> "Add elements to both ends with growing."
> data := Array streamContents: [ :stream |
> 10000 timesRepeat: [ stream nextPut: 2 atRandom ] ].
> (1 to: 5) collect: [ :run |
> [
> | o input each |
> o := OrderedCollection new.
> input := data readStream.
> [ (each := input next) == nil ] whileFalse: [
> each = 1
> ifTrue: [ o addFirst: each ]
> ifFalse: [ o addLast: each ] ] ] timeToRun ].
> #old -> #(2367 2393 2377 2426 2404).
> #new -> #(2 2 2 2 2)
>
> Feedback is welcome, as usual.
>
>
> Cheers,
> Levente
>
>




More information about the Squeak-dev mailing list