OrderedDictionary (was: Re: [squeak-dev] Re: The Trunk: Collections-mt.593.mcz)

Eliot Miranda eliot.miranda at gmail.com
Fri Jan 16 16:39:34 UTC 2015


Hi Marcel,

On Jan 16, 2015, at 8:28 AM, Marcel Taeumel <marcel.taeumel at student.hpi.uni-potsdam.de> wrote:

> Okay, the Array >> #do: comes down to Number's:
> 
> to: stop do: aBlock 
>    "Normally compiled in-line, and therefore not overridable.
>    Evaluate aBlock for each element of the interval (self to: stop by: 1)."
>    | nextValue |
>    nextValue := self.
>    [nextValue <= stop]
>        whileTrue: 
>            [aBlock value: nextValue.
>            nextValue := nextValue + 1]
> 
> And the LinkedList >> #do: is:
> 
> do: aBlock
>    | aLink |
>    aLink := firstLink.
>    [aLink == nil] whileFalse:
>        [aBlock value: aLink.
>         aLink := aLink nextLink]
> 
> So Array iteration has the incrementation of 1 in each iteration. That makes
> the difference? I thought that #to:do: is optimized as it does not appear on
> the stack... :)

Ghhh, it's too early :-). Only just now drinking some tea.  The Array implementation is compiled to an unlined while loop so all the overhead is in each application of at: that does bounds checking every time.

I'll profile this with the VMProfiler in a few minutes.  This is great news for Sista because this is some of the overhead it will eliminate.

> 
> Best,
> Marcel
> 
> 
> 
> --
> View this message in context: http://forum.world.st/The-Trunk-Collections-mt-593-mcz-tp4799750p4799947.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
> 


More information about the Squeak-dev mailing list