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

Chris Muller ma.chris.m at gmail.com
Thu Jul 18 23:03:47 UTC 2019


Wow, +1 then.  Amazing how you're able find this kind of performance
improvement in as low-level a method as String>>#at:ifAbsent:.

 - Chris

On Thu, Jul 18, 2019 at 5:58 PM Levente Uzonyi <leves at caesar.elte.hu> wrote:
>
> 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