<div dir="ltr">Just an update on this that the same is now true of `to_vector` with <a href="https://reviews.llvm.org/D112968">https://reviews.llvm.org/D112968</a>, so you can write `to_vector` without template arguments in the common case where the value type is inferrable.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 7, 2020 at 10:55 PM Chris Lattner via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.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"><div style="overflow-wrap: break-word;">Awesome, thank you Sean!<div><br></div><div>-Chris<br><div><br><blockquote type="cite"><div>On Dec 7, 2020, at 1:32 PM, Sean Silva via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br><div><div dir="ltr">TL;DR: SmallVector now chooses a default "N", and we recommend using that default. <div><br></div><div><div>We hope that this will</div><div>- Avoid semi-arbitrary choices for the "N" parameter.</div><div>- Save you extra edit/compile cycles for forgotten "N" parameters.</div><div>- Avoid some of the pathological cases of SmallVector use (like sizeof(SmallVector) becoming excessively large)</div><div></div><div><br></div><div>The programmer's manual has been updated, and now reads</div><div><br></div><div><span style="font-family:"Lucida Grande","Lucida Sans Unicode",Geneva,Verdana,sans-serif;font-size:14px">In the absence of a well-motivated choice for the number of inlined elements </span><code style="font-family:Consolas,"Deja Vu Sans Mono","Bitstream Vera Sans Mono",monospace;font-size:0.95em"><span>N</span></code><span style="font-family:"Lucida Grande","Lucida Sans Unicode",Geneva,Verdana,sans-serif;font-size:14px">, it is recommended to use </span><code style="font-family:Consolas,"Deja Vu Sans Mono","Bitstream Vera Sans Mono",monospace;font-size:0.95em"><span>SmallVector<T></span></code><span style="font-family:"Lucida Grande","Lucida Sans Unicode",Geneva,Verdana,sans-serif;font-size:14px"> (that is, omitting the </span><code style="font-family:Consolas,"Deja Vu Sans Mono","Bitstream Vera Sans Mono",monospace;font-size:0.95em"><span>N</span></code><span style="font-family:"Lucida Grande","Lucida Sans Unicode",Geneva,Verdana,sans-serif;font-size:14px">). This will choose a default number of inlined elements reasonable for allocation on the stack (for example, trying to keep </span><code style="font-family:Consolas,"Deja Vu Sans Mono","Bitstream Vera Sans Mono",monospace;font-size:0.95em"><span>sizeof(SmallVector<T>)</span></code><span style="font-family:"Lucida Grande","Lucida Sans Unicode",Geneva,Verdana,sans-serif;font-size:14px"> around 64 bytes).</span><br><div><div><br></div><div><a href="https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallvector-h" target="_blank">https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallvector-h</a><br></div></div></div><div><br></div><div>We haven't planned any big refactoring to use the new default, so we are expecting it to catch on organically in new code / code reviews / refactorings.</div><div><br></div><div>Enjoy! :)</div><div><br></div><div>For historical reference: This landed in <a href="https://reviews.llvm.org/D92522" target="_blank">https://reviews.llvm.org/D92522</a> after much <a href="https://groups.google.com/g/llvm-dev/c/Z-VwNCTRGSg/m/fYi0JHhzAwAJ" target="_blank">discussion on the list</a> and an <a href="https://reviews.llvm.org/D90884" target="_blank">earlier attempt at a patch</a> which went back and forth on various ideas, including more general aspirations for SmallVector's evolution. </div><div><br></div><div>-- Sean Silva</div></div></div>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br></div></blockquote></div><br></div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>