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 |
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 > > |
On Mon, 10 May 2010, Andreas Raab wrote:
> 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. Thanks for the feedback. I decided to wait for a few days, because these changes might break packages which include subclasses of OrderedCollection and override/send #grow or #growSize. Though chances are low, there was a similar case recently (Set/Dictionary with #findElementOrNil: and #fullCheck). So trunk users with such packages (if any) have a chance to prepare for these changes. Levente > > 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 >> >> > > > |
Free forum by Nabble | Edit this page |