[lld] r309652 - Binary search to find a relocation.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 23:01:41 PDT 2017


I quickly measured the time to link clang with/without -gdb-index on my
2-socket Xeon E5-2680 2.8GHz machine. The output size is about 1.7 GiB.

lld
8.207 seconds (without -gdb-idex)
8.262 seconds (with -gdb-index)

gold:
20.079 seconds (without -gdb-index)
26.724 seconds (with -gdb-index)

So, lld is much faster than gold, and the -gdb-index option is now almost
free with lld, which is really awesome!

On Wed, Aug 2, 2017 at 2:24 PM, Rui Ueyama <ruiu at google.com> wrote:

> Yes, looks like lld's -gdb-index is now much faster than gold's.
>
> On Wed, Aug 2, 2017 at 2:02 AM, Rafael Avila de Espindola <
> rafael.espindola at gmail.com> wrote:
>
>> This is awesome. It takes a link of clang with gdb index from about 21
>> seconds to 13.5 seconds for me!
>>
>> Cheers,
>> Rafael
>>
>> Rui Ueyama via llvm-commits <llvm-commits at lists.llvm.org> writes:
>>
>> > Author: ruiu
>> > Date: Mon Jul 31 21:11:03 2017
>> > New Revision: 309652
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=309652&view=rev
>> > Log:
>> > Binary search to find a relocation.
>> >
>> > This change makes -gdb-index 40% faster. My test case is self-linking
>> lld.
>> >
>> > Differential Revision: https://reviews.llvm.org/D36079
>> >
>> > Modified:
>> >     lld/trunk/ELF/GdbIndex.cpp
>> >
>> > Modified: lld/trunk/ELF/GdbIndex.cpp
>> > URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/GdbIndex.
>> cpp?rev=309652&r1=309651&r2=309652&view=diff
>> > ============================================================
>> ==================
>> > --- lld/trunk/ELF/GdbIndex.cpp (original)
>> > +++ lld/trunk/ELF/GdbIndex.cpp Mon Jul 31 21:11:03 2017
>> > @@ -79,11 +79,13 @@ template <class RelTy>
>> >  Optional<RelocAddrEntry>
>> >  LLDDwarfObj<ELFT>::findAux(const InputSectionBase &Sec, uint64_t Pos,
>> >                             ArrayRef<RelTy> Rels) const {
>> > -  auto I = llvm::find_if(Rels,
>> > -                         [=](const RelTy &Rel) { return Rel.r_offset
>> == Pos; });
>> > -  if (I == Rels.end())
>> > +  auto It = std::lower_bound(
>> > +      Rels.begin(), Rels.end(), Pos,
>> > +      [](const RelTy &A, uint64_t B) { return A.r_offset < B; });
>> > +  if (It == Rels.end() || It->r_offset != Pos)
>> >      return None;
>> > -  const RelTy &Rel = *I;
>> > +  const RelTy &Rel = *It;
>> > +
>> >    const ObjFile<ELFT> *File = Sec.getFile<ELFT>();
>> >    uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
>> >    const typename ELFT::Sym &Sym = File->getELFSymbols()[SymIndex];
>> >
>> >
>> > _______________________________________________
>> > llvm-commits mailing list
>> > llvm-commits at lists.llvm.org
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170802/e02db64f/attachment-0001.html>


More information about the llvm-commits mailing list