<div dir="ltr">Note that your statistics do not account for transient collections. If minimizing the initial capacity made most uses of these collections slower, it might not be justified to do so.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Fr., 24. Jan. 2020 um 23:28 Uhr schrieb Chris Muller <<a href="mailto:asqueaker@gmail.com">asqueaker@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Wow, the number of oversized OrderedCollection instances is much worse, 92%.<div><br></div><div>((OrderedCollection allInstances count: [ : e | e size < 10 and: [ e array size >= 10 ] ]) /<br>OrderedCollection allInstances size) asFloat.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 24, 2020 at 4:01 PM Chris Muller <<a href="mailto:asqueaker@gmail.com" target="_blank">asqueaker@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>In my trunk image, currently >10% of Dictionary instances have unnecessarily large internal arrays because they were created with #new but never grew.  <div><br></div><div>     ((Dictionary allInstances count: [ : e | e size < 3 and: [ e array size >= 5 ] ]) / Dictionary allInstances size) asFloat      "0.11282051282051282"</div><div><br></div><div>A developer wanting compactness should not be required to probe into the internal implementation to know whether they can write the most compact code, "Dictionary new" and "Set new".  The most compact code should result in the most compact size by default, and only if a *larger* default size is desired, use #new: for optimization.</div><div><br></div><div>This also addresses the issue I've been discussing with Levente, ensuring #new: maintains its performance optimization along with space, as with OrderedCollections, etc.</div><div><br></div><div>Best,</div><div>  Chris</div><div><br><br><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 24, 2020 at 3:32 PM <<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Chris Muller uploaded a new version of Collections to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Collections-cmm.874.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/inbox/Collections-cmm.874.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Collections-cmm.874<br>
Author: cmm<br>
Time: 24 January 2020, 3:32:43.628249 pm<br>
UUID: 107f3a74-177c-4338-9ad3-648e427419a1<br>
Ancestors: Collections-ul.871<br>
<br>
- Optimize for system compactness by ensuring the default internal array size of any HashedCollection is not initialized larger than it may ever need to be.<br>
- Let #new: be used to define larger sizes than the minimum, and perform comparably with #new even if the minimum size is specified.<br>
<br>
=============== Diff against Collections-ul.871 ===============<br>
<br>
Item was changed:<br>
  ----- Method: HashedCollection class>>new (in category 'instance creation') -----<br>
  new<br>
+       ^ self basicNew initialize: 3!<br>
-       ^ self basicNew initialize: 5!<br>
<br>
<br>
</blockquote></div>
</blockquote></div>
<br>
</blockquote></div>