[squeak-dev] The Inbox: Chronology-Core-dtl.56.mcz

David T. Lewis lewis at mail.msen.com
Sat Sep 5 02:10:21 UTC 2020


On Fri, Sep 04, 2020 at 09:04:08PM -0400, David T. Lewis wrote:
> 
> On Sat, Sep 05, 2020 at 12:01:21AM +0200, Levente Uzonyi wrote:
> 
> > 2) Some replacement methods are not quick and create new objects. For 
> > example, OneDay, a single Duration of one day is replaced with #oneDay, a 
> > method returning the expression 1 day. Each invocation of the method 
> > creates a new object.
> > In my image, there are 19821 Date instances. If all of those had their own 
> > custom one day long Duration objects, which is a side effect of these 
> > changes in the long run, my image would be ~620 kiB larger (64-bit image, 
> > object header + 2 variables => 32 bytes each).
> > There's a solution: cache the shared instance in a variable. :)
> 
> If it is a problem, then this is an error on my part (not Juan's). After
> adopting the main part of the Cuis changes, #oneDay was one of a couple
> of remaining cases that I addressed with trivial replacements.
> 
> But there are no senders of #oneDay in the image other than a unit test.
> So I think that it is not likely to be an issue.
> 

Levente,

My apologies, I was careless and you are right. Duration class>>oneDay is
sent by Date class>>starting: and therefore it does create redundant new
objects exactly as you said.

This is an error on my part and would need to be fixed before the changes
could be considered for trunk.

Dave



More information about the Squeak-dev mailing list