<div dir="ltr">Yes, looks like lld's -gdb-index is now much faster than gold's.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 2, 2017 at 2:02 AM, Rafael Avila de Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is awesome. It takes a link of clang with gdb index from about 21<br>
seconds to 13.5 seconds for me!<br>
<br>
Cheers,<br>
Rafael<br>
<div class="HOEnZb"><div class="h5"><br>
Rui Ueyama via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> writes:<br>
<br>
> Author: ruiu<br>
> Date: Mon Jul 31 21:11:03 2017<br>
> New Revision: 309652<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=309652&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=309652&view=rev</a><br>
> Log:<br>
> Binary search to find a relocation.<br>
><br>
> This change makes -gdb-index 40% faster. My test case is self-linking lld.<br>
><br>
> Differential Revision: <a href="https://reviews.llvm.org/D36079" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D36079</a><br>
><br>
> Modified:<br>
> lld/trunk/ELF/GdbIndex.cpp<br>
><br>
> Modified: lld/trunk/ELF/GdbIndex.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/GdbIndex.cpp?rev=309652&r1=309651&r2=309652&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>GdbIndex.cpp?rev=309652&r1=<wbr>309651&r2=309652&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- lld/trunk/ELF/GdbIndex.cpp (original)<br>
> +++ lld/trunk/ELF/GdbIndex.cpp Mon Jul 31 21:11:03 2017<br>
> @@ -79,11 +79,13 @@ template <class RelTy><br>
> Optional<RelocAddrEntry><br>
> LLDDwarfObj<ELFT>::findAux(<wbr>const InputSectionBase &Sec, uint64_t Pos,<br>
> ArrayRef<RelTy> Rels) const {<br>
> - auto I = llvm::find_if(Rels,<br>
> - [=](const RelTy &Rel) { return Rel.r_offset == Pos; });<br>
> - if (I == Rels.end())<br>
> + auto It = std::lower_bound(<br>
> + Rels.begin(), Rels.end(), Pos,<br>
> + [](const RelTy &A, uint64_t B) { return A.r_offset < B; });<br>
> + if (It == Rels.end() || It->r_offset != Pos)<br>
> return None;<br>
> - const RelTy &Rel = *I;<br>
> + const RelTy &Rel = *It;<br>
> +<br>
> const ObjFile<ELFT> *File = Sec.getFile<ELFT>();<br>
> uint32_t SymIndex = Rel.getSymbol(Config-><wbr>IsMips64EL);<br>
> const typename ELFT::Sym &Sym = File->getELFSymbols()[<wbr>SymIndex];<br>
><br>
><br>
> ______________________________<wbr>_________________<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/<wbr>mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>