[squeak-dev] The Inbox: Collections-ul.844.mcz

Levente Uzonyi leves at caesar.elte.hu
Thu Jul 18 22:58:46 UTC 2019


On Thu, 18 Jul 2019, Chris Muller wrote:

> Is it faster even if the argument to ifAbsent: is simply "nil" instead of "[nil]"?

More than 4x faster when the index is valid and more than twice as fast 
when the index is not valid.

Levente

> 
> On Thu, Jul 18, 2019 at 5:13 PM <commits at source.squeak.org> wrote:
>       Levente Uzonyi uploaded a new version of Collections to project The Inbox:
>       http://source.squeak.org/inbox/Collections-ul.844.mcz
>
>       ==================== Summary ====================
>
>       Name: Collections-ul.844
>       Author: ul
>       Time: 19 July 2019, 12:08:51.94435 am
>       UUID: df5ebfa9-4ebf-4505-8031-afd892a1061c
>       Ancestors: Collections-mt.843
>
>       - added String >> #atOrNil: which uses primitive 63 and returns either the character at the given index or nil when the primtiive fails. This is a faster alternative to #at:ifAbsent: when the absent block would
>       yield nil.
>
>       =============== Diff against Collections-mt.843 ===============
>
>       Item was added:
>       + ----- Method: String>>atOrNil: (in category 'as yet unclassified') -----
>       + atOrNil: anIndex
>       +       "Return the character at anIndex or nil if the index or the argument is not valid."
>       +
>       +       <primitive: 63>
>       +       ^nil!
> 
> 
> 
>


More information about the Squeak-dev mailing list