Idea for a possibly better Collection occurrencesOf method.

Jon Hylands jon at huv.com
Tue Sep 12 10:19:02 UTC 2006


On Tue, 12 Sep 2006 09:31:40 +0200, "Klaus D. Witzel"
<klaus.witzel at cobss.com> wrote:

> Whatever "better" method is used, they all have to send the #do: message  
> and so:
> 
> - #do: must be fastest
> - users of #do: must be slower than pure #do:

A while ago, the guys at IBM did a very interesting performance upgrade to
VisualAge Smalltalk - they "fixed" the standard enumeration methods so they
all have (more or less) identical performance. They wrote a collection
iterator primitive method in BlockContext:

apply: aCollection from: start to: end

This method calls an iterator primitive, and all the collection iterators
end up calling this method, and it has taken away pretty much all the
performance differences between using #to:do:, #do:, #select:,
#inject:into:, etc.

It used to be that the only way to get fast collection iteration was to use
#to:do: (because it is inlined). Now they all run at the same speed, which
is really fast.

Later,
Jon

--------------------------------------------------------------
   Jon Hylands      Jon at huv.com      http://www.huv.com/jon

  Project: Micro Seeker (Micro Autonomous Underwater Vehicle)
           http://www.huv.com



More information about the Squeak-dev mailing list