<div style="font-family: arial, helvetica, sans-serif"><font size="2"><div class="gmail_quote">On Fri, Jun 15, 2012 at 7:04 PM, Jakob Stoklund Olesen <span dir="ltr"><<a href="mailto:stoklund@2pi.dk" target="_blank">stoklund@2pi.dk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div class="im"><br><div><div>On Jun 15, 2012, at 6:18 PM, Chandler Carruth wrote:</div>
<br><blockquote type="cite"><span style="border-collapse:separate;font-family:Optima;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><span style="font-family:monospace">This is pretty ugly, but it allows the super class to change the<br>
representation of these values, which will be key for doing<br>a SmallDenseMap.<br><br>Suggestions on better method structuring / naming are welcome, but keep<br>in mind that SmallDenseMap won't have an 'unsigned' member to expose<br>
a reference to... =/<br></span></span></blockquote></div><br></div><div>Do we have any use cases where a DenseMap would be better than a SmallDenseMap? It's hard to think of cases where std::vector is better than SmallVector.</div>
</div></blockquote><div><br></div><div>The one that jumps to mind is when we the map will have one of two states: a reasonable number of entries or zero entries. Especially if these maps are inside of other datastructures, we don't want to pay inline storage for all the empty maps.</div>
<div><br></div><div>One unfortunate thing is that the small variation will only be able to store a single bucket for free, and the cost will be a branch along the hot path of most operations. We could remove the branch, but that will cause us to be able to store *no* buckets for free in terms of storage.</div>
<div><br></div><div>We'd need to run a lot of benchmarks I suspect to be able to tell if DenseMap<X, Y> could be equivalent to SmallDenseMap<X, Y, 1>... but if we get there, I'll be happy to rip out a bunch of code. =] Keeping both seems useful for the transitional period anyways.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>It seems this could be a lot simpler if you didn't have to preserve the original DenseMap exactly.</div>
<span class="HOEnZb"><font color="#888888"><div><br></div><div>/jakob</div><div><br></div></font></span></div><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" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></font></div>