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

Juan Vuletich JuanVuletich at zoho.com
Mon May 2 07:12:43 PDT 2022


On 5/1/2022 10:38 AM, Luciano Notarfrancesco via Cuis-dev 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).

Now at GitHub.

Thanks!

-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
https://independent.academia.edu/JuanVuletich
https://www.researchgate.net/profile/Juan-Vuletich
https://patents.justia.com/inventor/juan-manuel-vuletich
https://twitter.com/JuanVuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220502/ec8b3510/attachment.htm>


More information about the Cuis-dev mailing list