<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 29, 2016 at 2:21 PM, Mehdi AMINI via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">joker.eph added inline comments.<br>
<br>
================<br>
</span>Comment at: include/llvm/ADT/StringMap.h:261<br>
@@ +260,3 @@<br>
<span class="">+    NumItems = RHS.NumItems;<br>
+    NumTombstones = RHS.NumTombstones;<br>
+    for (unsigned I = 0, E = NumBuckets; I != E; ++I) {<br>
</span>----------------<br>
hfinkel wrote:<br>
<span class="">> joker.eph wrote:<br>
> > I wonder if we really want to keep the tombstones or if it wouldn't be better to reinsert the elements?<br>
</span>> I don't have a good feeling for this; it seems like this could mean one of two things:<br>
><br>
>  1. We start with the same number of buckets as the RHS; in this case keeping the tombstones vs. not just affects whether we write a 0 or -1 into the pointer array for the empty slot (although insertion will prefer that slot over further probing).<br>
>  2. Start with a minimal number of buckets. Potentially more memory efficient, but essentially leads to "rehashing" (which in this case means re-probing for all inputs).<br>
><br>
> What do you prefer?<br>
It seems to me that when looking for an entry in the map, the search stops when it find an empty slot, but continue when there is a tombstone. If I understand your 1), it is just replacing tombstones with empty buckets, but that would break the search for existing entries that are after the tombstones.<br>
<br>
The 2) is basically what I was thinking of, eventually allocating the same number of buckets, but indeed reinserting each entry (reusing the existing known hash). Not that I have a strong preference, I was rather wondering if you considered this and what is the rational for one or the other (and if there is a reason, I'd rather have it documented in the code for future reference).<br>
I hope David could chime in with an opinion.<br></blockquote><div><br></div><div>I'm reading/watching. Don't have a strong/clear opinion here either - will voice one if/when I do :) Happy to help throw around ideas, etc.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
================<br>
Comment at: include/llvm/ADT/StringMap.h:272<br>
@@ +271,3 @@<br>
</span><span class="">+      HashTable[I] = RHSHashTable[I];<br>
+    }<br>
+  }<br>
</span>----------------<br>
hfinkel wrote:<br>
<span class="">> joker.eph wrote:<br>
> > The hashes have to be inserted as well I think (after the buckets), I may miss where it happened?<br>
</span>> Yes; that's what the<br>
<span class="">><br>
>   HashTable[I] = RHSHashTable[I];<br>
><br>
</span>> does.<br>
Obviously...<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<a href="http://reviews.llvm.org/D18506" rel="noreferrer" target="_blank">http://reviews.llvm.org/D18506</a><br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div></div>