<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Awesome, thank you Sean!<div class=""><br class=""></div><div class="">-Chris<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Dec 7, 2020, at 1:32 PM, Sean Silva via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">TL;DR: SmallVector now chooses a default "N", and we recommend using that default. <div class=""><br class=""></div><div class=""><div class="">We hope that this will</div><div class="">- Avoid semi-arbitrary choices for the "N" parameter.</div><div class="">- Save you extra edit/compile cycles for forgotten "N" parameters.</div><div class="">- Avoid some of the pathological cases of SmallVector use (like sizeof(SmallVector) becoming excessively large)</div><div class=""></div><div class=""><br class=""></div><div class="">The programmer's manual has been updated, and now reads</div><div class=""><br class=""></div><div class=""><span style="font-family: "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif; font-size: 14px;" class="">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;" class=""><span class="">N</span></code><span style="font-family: "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif; font-size: 14px;" class="">, it is recommended to use </span><code style="font-family: Consolas, "Deja Vu Sans Mono", "Bitstream Vera Sans Mono", monospace; font-size: 0.95em;" class=""><span class="">SmallVector<T></span></code><span style="font-family: "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif; font-size: 14px;" class=""> (that is, omitting the </span><code style="font-family: Consolas, "Deja Vu Sans Mono", "Bitstream Vera Sans Mono", monospace; font-size: 0.95em;" class=""><span class="">N</span></code><span style="font-family: "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif; font-size: 14px;" class="">). 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;" class=""><span class="">sizeof(SmallVector<T>)</span></code><span style="font-family: "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif; font-size: 14px;" class=""> around 64 bytes).</span><br class=""><div class=""><div class=""><br class=""></div><div class=""><a href="https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallvector-h" target="_blank" class="">https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallvector-h</a><br class=""></div></div></div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">Enjoy! :)</div><div class=""><br class=""></div><div class="">For historical reference: This landed in <a href="https://reviews.llvm.org/D92522" target="_blank" class="">https://reviews.llvm.org/D92522</a> after much <a href="https://groups.google.com/g/llvm-dev/c/Z-VwNCTRGSg/m/fYi0JHhzAwAJ" target="_blank" class="">discussion on the list</a> and an <a href="https://reviews.llvm.org/D90884" target="_blank" class="">earlier attempt at a patch</a> which went back and forth on various ideas, including more general aspirations for SmallVector's evolution. </div><div class=""><br class=""></div><div class="">-- Sean Silva</div></div></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></body></html>