Performance figures [Re: Idea for a possibly better Collection occurrencesOf method]

Klaus D. Witzel klaus.witzel at cobss.com
Wed Sep 13 19:35:01 UTC 2006


Hi Jon,

on Wed, 13 Sep 2006 19:43:38 +0200, you wrote:
> On Wed, 13 Sep 2006 18:10:30 +0200, "Klaus D. Witzel" wrote:
>
>> I doubt that a primitive implementation would show a significantly  
>> better
>> factor, because the VM already is fast! and because in practice the
>> #to:do: intervals are usually smaller than in the above. The only
>> difference I saw in the bytecodes was related to the #to:do: and #value:
>> message send.
>
> The point of the #apply... primitive is so that all the enumeration  
> methods
> run as fast as #to:do:,

Absolutely. The primitive code has to be shadowed (because of the always  
possible #primitiveFailed situation) and the one shadow that is also  
inlined by the compiler is
  start to: stop do: [:index | self "I'm the block" value: (seqColl at:  
index)]

#primitiveApply:from:to: can do faster but not better, there is no  
solution with less code.

> so you don't have to worry about trading off code
> clarity and re-use for performance.

I cannot say that I understand this sentence (read it time and again, but  
no clue). What's the connection.

/Klaus

> Later,
> Jon




More information about the Squeak-dev mailing list