[squeak-dev] The Trunk: Collections-eem.792.mcz

David T. Lewis lewis at mail.msen.com
Mon May 7 22:58:44 UTC 2018


On Mon, May 07, 2018 at 03:02:10PM -0500, Chris Muller wrote:
> Hi Levente,
> 
> 
> > meant.  My own criteria is "methods which are called thousands of times
> >> per minute" _today_.
> >>
> >
> 
> > A rule of thumb could be that if a core method (e.g. anything in
> > Kernel/Collections) is part of an API and it's not there to support a very
> > specific task (e.g. Dictionary >> #associationDeclareAt:), then its
> > performance should be taken into account.
> >
> 
> That sounds like it only exempts utility methods ("specific tasks").
> Technically, this should leave me afraid that you might want to inline
> Dictionary>>#at:, but I'm relatively sure you don't.  #at: is the most
> basic featured accessing method for understanding and using a Dictionary,
> so I hope you agree that's one that should retain its exemplar status.
> 
> OTOH, #associationDeclareAt: and #isOctetString, by their nature, are only
> of interest to developers.  Users would never use those methods, so
> optimizing them would be fine I suppose.  Methods which take block
> arguments also tend to be not as usable by users, since passing a block
> requries writing some code.  So it seems we have _some_ concrete criteria
> starting to form simply by having looked at a few examples:
> 
>    - methods which run hundreds of times per minute
>    - methods which take block as arguments
>    - methods which are concerned with internals instead of externals
> 
> #isAsciiString seems like it could go either way, so I'm fine if you and
> Eliot prefer it to be optimized.  For me this discussion itself to get a
> slightly better understanding of each others' positions with the request to
> keep Dynabook users in mind when evaluating future such optimizations, is
> more important.
> 

I have no strong opinion one way or the other, but for what it's worth I
though that Eliot's optimization was readable enough, and the method comment
made the intent clear. As a learning tool, it might even be helpful for
someone reading the method for the first time to understand the alternative
implementations, one favoring speed and another expressing the same idea
in terms of collections with #allSatisfy: 

Dave



More information about the Squeak-dev mailing list