[Cuis-dev] Faster Collection>>#count:, Bag>>#collect: and Bag>>#count:

Luciano Notarfrancesco luchiano at gmail.com
Sun May 1 06:32:24 PDT 2022


BTW, I ran all the base image tests and all pass.

On Sun, 1 May 2022 at 8:38 PM Luciano Notarfrancesco <luchiano at gmail.com>
wrote:

> This changeset changes Collection>>#count: to be simpler and faster (with
> an Array of size 10000 I see a 35% speedup), and implements faster
> Bag>>#count: and Bag>>#collect: that avoids evaluating the block on
> multiple occurrences of the same element.
>
> Both Bag>>#count: and Bag>>#collect: assume that the block is a function
> (i.e., returns the same result when evaluated twice on the same element). I
> think this is a fair assumption, and anyway we have the same assumption in
> Bag>>#select: (which I wrote in 1998, apparently).
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220501/b3fa7c91/attachment.htm>


More information about the Cuis-dev mailing list