<div dir="ltr"><div dir="ltr">On Fri, Jan 24, 2020 at 6:19 PM Levente Uzonyi <<a href="mailto:leves@caesar.elte.hu" target="_blank">leves@caesar.elte.hu</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Chris,<br>
<br>
On Fri, 24 Jan 2020, Chris Muller wrote:<br>
<br>
> Hi Jakob,<br>
> <br>
> Optimal execution performance can never be assured with #new, since the potential cost of under-allocation in various places is offset by the gains of not over-allocating in other places. <br>
> <br>
> Although it's impossible to tweak the default initial size in #new to optimize for performance, we can at least optimize for space, and also for clarity-of-usage.  #new, by nature, expresses a "lack of concern for optimization", so Squeak should at least provide compactness in that case.  Places in the code that<br>
> need optimization will correctly express that by writing #new: with a larger pre-allocation.<br>
> <br>
> It's true that system level changes of any kind could result in the need for downstream changes but, in this case, it seems very unlikely.<br>
<br>
The way I understand it, Jakob says that your suggested change has a <br>
chance to slow down things just to save a few hundred kilobytes of memory. <br></blockquote><div><br></div><div>But your suggested change is 100% *guaranteed* to slow things down, with no space savings.</div><div><br></div><div>This avoids that particular slow down, while guarantee'ing to save space!  All for only a very <i>teency-weency chance</i> of other areas being minorly affected (and, easily fixed if they are!).<br></div><div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I don't think we would want to do that without measuring the effects of <br>
the change somehow.<br></blockquote><div><br></div><div><div>Performance measuring is already part of every system that cares, right?   :)</div><div></div></div><div>None of those systems are depending on any particular default initial size for performance.  If they are, they should be fixed.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Same applies to OrderedCollections.<br>
<br>
Following your reasoning, the optimal initial capacity for any dynamic <br>
collection created with #new should be 0, but that doesn't feel right...<br></blockquote><div><br></div><div>Not 0, 3.  It's "reasoning", not extremism.  :)</div><div><br></div><div>3 would be a great default for OrderedCollection.  Ultra-minimal, but with a purpose.   I mean, really, with 10, we have 92% of all instances wasting space.</div><div><br></div><div> - Chris</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
</blockquote></div></div>