Idea for a possibly better Collection occurrencesOf method.
Klaus D. Witzel
klaus.witzel at cobss.com
Tue Sep 12 11:00:16 UTC 2006
On Tue, 12 Sep 2006 12:19:02 +0200, Jon Hylands wrote:
> On Tue, 12 Sep 2006 09:31:40 +0200, "Klaus D. Witzel" 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
Heh, why haven't we stupid non-corporate users come up with such a
brilliant idea ;-)
IMO this is (perhaps) something for Exupery.
> 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.
Thank you for sharing the find, Jon.
/Klaus
> Later,
> Jon
More information about the Squeak-dev
mailing list
|