<div dir="ltr">I know that, but I'm talking about allocation speed, not access speed.  This #new: violates the expectations of your typical Smalltalk programmer, they'll write code they think is optimized but, actually, is much much slower.<div><br></div><div></div><div>Surely there's a faster way to come up with a next-higher prime?  Certainly, that primes table seems unnecessarily large for this purpose -- anyone creating a Dictionary with > 1M preallocated slots is a special-case scenario we should not slow down the "normal" cases for...<br></div><div><br></div><div> - Chris</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 17, 2019 at 4:33 PM Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@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="auto">Hi Chris,<div dir="auto">The purpose of good prime sizes is to accelerate random access at: and at:put:. So more ellaborate bench should be used to measure if worth.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 17 déc. 2019 à 23:02, Chris Muller <<a href="mailto:asqueaker@gmail.com" target="_blank">asqueaker@gmail.com</a>> a écrit :<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>I just noticed that attempting to optimize the creation of a Dictionary or OrderedDictionary by specifying a pre-allocated size, actually slows the system down more than not using this optimization.  In trunk, see?</div><div><br></div><div>[Dictionary new] bench.        '26,300,000 per second. 38.1 nanoseconds per run. 9.21816 % GC time.'<br><br>[Dictionary new: 4] bench.       '3,560,000 per second. 281 nanoseconds per run. 2.41952 % GC time.'<br><br>So then I tried to debug it to see why, and I couldn't without my Tools-cmm.926 patch currently in the Inbox for review.<br><br>       Dictionary new: 4    "try to debug-it and step into"<br><br>The whole purpose of #new: over #new is to increase the performance of allocation when the minimum size is known in advance, but we seem to have killed this goal by the cost of #goodPrimeAtLeast:.  Levente?<br></div><div><br></div><div>Best,</div><div>  Chris</div></div>
<br>
</blockquote></div>
<br>
</blockquote></div>