<div dir="ltr"><div>Is there a specific place where we're storing SmallVectors in a datastructure that you're trying to optimize with this? It might be worth investing in a more general small-sizeof vector than TinyPtrVector. The way the SmallVector currently works (such as actually containing a 3 pointer "vector header") imposes some fundamental limitations on its sizeof.</div><div><br></div><div>There are various standard ways to greatly reduce sizeof of vectors especially in 64-bit address spaces (and certain assumptions on the OS...) where often the high bits are redundant, allowing the vector header to be compressed to a single pointer in size across a very large size range. Even without the spacious high-bits of a 64-bit address space, we can often store at least up to size 4 or 8 in the low bits, which for many use cases is plenty in the common case.</div><div><div><br></div><div>(to be clear, I think this patch makes sense; just had a high-level question)<br><div><br></div><div>-- Sean Silva<br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 30, 2015 at 5:34 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I'd just commit this, but I want to check:<br>
<br>
 1. Are my static asserts valid under MSVC?  Sanitizers?  If not, what<br>
    *is* a portable way to check that we don't waste memory here?<br>
 2. I like them in SmallVector.h (assuming they're portable).<br>
    Anyone strongly prefer ADTTests?<br>
<br>
Avoid an unused byte -- which for `sizeof(T) >= sizeof(void *)` costs<br>
a pointer -- on `SmallVector<T, 1>`.  Shave the same byte off of<br>
`SmallVector<T, 0>`.  Otherwise, no functionality change.<br>
<br>
Note that `SmallVector<T, 0>` has the same memory footprint as<br>
`SmallVector<T, 1>`, which seems like a bug to me.  We should probably<br>
fix that too.<br>
<br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div></div></div></div>