<div dir="ltr"><div class="gmail_quote"><div>Hi Levente,</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">+       lowerLimit <= 7 ifTrue: [<br>
+               lowerLimit <= 3 ifTrue: [ ^3 ].<br>
+               lowerLimit <= 5 ifTrue: [ ^5 ].<br>
+               ^7 ].</blockquote><div><br></div><div>That's better, but it still has that same fundamental problem.  Every time a developer makes a HashedCollection of a known-at-runtime size (e.g., in a variable), they're forced to choose between execution performance pain or code pain.</div><div><br></div><div>    {<br></div><div>   '[ Dictionary new ]'->'100% of baseline rate, 27,600,000 per second. 36.2 nanoseconds per run. 11.33547 % GC time.'<br><br></div><div>    "performance pain?"</div><div>    '[ Dictionary new: 1 ]'->'60% of baseline rate, 16,600,000 per second. 60.1 nanoseconds per run. 5.61888 % GC time.'<br>    '[ Dictionary new: 2 ]'->'61% of baseline rate, 16,900,000 per second. 59.2 nanoseconds per run. 5.67886 % GC time.'<br>    '[ Dictionary new: 3 ]'->'59% of baseline rate, 16,300,000 per second. 61.5 nanoseconds per run. 6.77864 % GC time.'</div><div><br></div><div>    "into #sizeFor:"<br>    '[ Dictionary new: 4 ]'->'57% of baseline rate, 15,800,000 per second. 63.5 nanoseconds per run. 7.87685 % GC time.'</div><div><br>    "or code pain?"<br></div><div>    '[ sz > 3<br></div><div>            ifTrue: [ Dictionary new: sz ]<br>            ifFalse: [ Dictionary new ] ]'->'97% of baseline rate, 26,900,000 per second. 37.2 nanoseconds per run. 11.09778 % GC time.'}<br></div><div><br></div><div>For the most part, they won't even know about this anomaly (and shouldn't have to).  No one assumes such a heavy penalty for #new: over #new when the size is <= the default size.</div><div><br></div><div>I like every other aspect of your improvements here!  But may we go with the Collections-cmm.873 variation please?  It fixes that issue, check it out!<br></div><div><br></div><div>    {'[ Dictionary new ]'->'100% of baseline rate, 29,100,000 per second. 34.4 nanoseconds per run. 5.9988 % GC time.'<br>    '[ Dictionary new: 1 ]'->'103% of baseline rate, 29,900,000 per second. 33.4 nanoseconds per run. 4.9 % GC time.'<br>    '[ Dictionary new: 2 ]'->'103% of baseline rate, 30,100,000 per second. 33.2 nanoseconds per run. 4.88 % GC time.'<br>    '[ Dictionary new: 3 ]'->'95% of baseline rate, 27,600,000 per second. 36.3 nanoseconds per run. 5.62 % GC time.'</div><div><br></div><div>Best,</div><div>  Chris</div><div><br></div><div><br></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"> </blockquote></div></div>