<div dir="ltr"><div dir="ltr">Hi Jakob,</div><br><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"><div dir="auto"><div dir="auto">I still don't see a compelling reason to change #new.</div></div></blockquote><div><br></div><div>Levente's proposal changes it.  That's what sparked this whole conversation...</div><div> <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"><div dir="auto"><br></div><div dir="auto">In one paragraph you write about using new: "proactively" and in the next you write this is not about performance.</div></div></blockquote><div><br></div><div>The "proactively" was only in response to Nicolas and you talking about "premature optimization", which was wrong.  When you say:</div><div><br></div><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"><div dir="auto">I only use new: when I know that it gives me a better result, after I noticed that I need a better result. "Proactive" from the start implies premature optimisation for me.</div></div></blockquote><div></div></div><div><br></div><div>it's like saying, "Writing Dictionary>>#at: optimally before my application suffers performance problems is 'premature optimization'."  Totally wrong.</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"><div dir="auto"><div dir="auto"><br></div><div dir="auto">My opinion on the API: if I start out with no specific knowledge about the expected size of my collection or I don't think that is relevant, I use new.  That is 99% of the cases.</div></div></blockquote><div><br></div><div>Those cases are irrelevant.  The cases we're discussing are the ones when the size is known at runtime.</div><div> <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"><div dir="auto"><br></div><div dir="auto"><span style="font-family:sans-serif">I expect that the standard library gives me a default that has proven to work well in most cases. By "work well" I predominantly think of time-efficiency, not space-efficiency.</span></div></div></blockquote><div><br></div><div>That sounds personal.  One thing that may help is what I suggested to Levente, try writing a manpage-quality comment for #new: explaining all the nuances...  when to use it, when not to, etc...  My hope that exercise would illuminate the issue I have.</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"><div dir="auto"><div dir="auto"><span style="font-family:sans-serif"><br></span></div><div dir="auto"><span style="font-family:sans-serif">We can look at other such libraries, OpenJDK also uses 10 for ArrayList: </span><font face="sans-serif"><a href="http://hg.openjdk.java.net/jdk/jdk/file/9211f6e20448/src/java.base/share/classes/java/util/ArrayList.java#l118" target="_blank">http://hg.openjdk.java.net/jdk/jdk/file/9211f6e20448/src/java.base/share/classes/java/util/ArrayList.java#l118</a></font></div><div dir="auto"><br></div><div dir="auto"></div></div></blockquote><div><br></div><div>Java based its core library off Smalltalk, Jakob..</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"><div dir="auto"><div dir="auto"><br></div><div dir="auto">Also I don't expect that initial allocation with new: will always be faster. I expect that I can save reallocations later on. </div></div></blockquote><div><br></div><div>As I said before, not if you know your Dictionary will never grow.   This is not app-specific.</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"><div dir="auto"><div dir="auto">That is where the time is supposed to be saved. If new is faster than new: 1, I am fine with that.</div></div></blockquote><div><br></div><div>This thread is about reducing the defaultSize.  The other thread is about #new:1 needing to be same speed as #new.  They're two separate discussions.  An API design that forces developers to trade one optimization for another is bad design, plain and simple.  Levente's other changes in Collections-ul are good, but to introduce a needless API regression is pointless, and not okay.  We would need one solution or the other.</div><div><br></div><div> - Chris</div></div></div>