<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Jul 27, 2015 at 4:38 PM Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jul 27, 2015 at 4:18 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><span><div dir="ltr">On Mon, Jul 27, 2015 at 2:02 PM Rui Ueyama <<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>> wrote:<br></div></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><div dir="ltr"><div>On Mon, Jul 27, 2015 at 12:01 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br></div></div></span><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><span><br>
> On 2015-Jul-25, at 17:50, Rui Ueyama <<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>> wrote:<br>
><br>
> Author: ruiu<br>
> Date: Sat Jul 25 19:50:15 2015<br>
> New Revision: 243232<br>
><br></span>
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D243232-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=A7YEbZn5UiSjeArc6rLNc6OXlfY7Hm0OXfSQWGYHAns&s=wmdRPI5Lb9TNc_6lTBnZH0eo6CyF0IJSE6TQ7CrgwlU&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=243232&view=rev</a><span><br>
> Log:<br>
> ELF2: Avoid calling std::sort to make output deterministic.<br>
<br>
</span></span><span>Using `std::stable_sort` should also make it deterministic.  Is that<br>
better than switching to a `std::map`?<br></span></blockquote><div><br></div></div></div></div><span><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Yeah, I think the new code is slightly more readable than the previous one. At least it's shorter than before.</div></div></div></div></span></blockquote><div><br></div><div><br></div><div>"Yeah" doesn't seem to agree with the rest of your email, so I'm left confused.</div><div><br></div><div>Why wouldn't switching to std::stable_sort be better?</div><div><br></div><div>std::map is horribly slow in essentially every way, and so I struggle to believe it is the best tool for the job even if the code using it is very compact.</div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>std::stable_sort would actually be slower than the new code. What we are doing here is bin chunks into a few sections, so putting everything into one array and stable-sorting them and scanning them again doesn't make much sense. We used std::stable_sort in COFF before but I removed that in r239292 for that reason.<br></div></div></div></div></blockquote><div><br></div><div>Ok, *this* makes more sense, thanks for that context.</div></div></div>