Re: small development tip: Consider using the gold linker - Mailing list pgsql-hackers

From Andres Freund
Subject Re: small development tip: Consider using the gold linker
Date
Msg-id 20220223002638.vicup5bxeefaobg5@alap3.anarazel.de
Whole thread Raw
In response to Re: small development tip: Consider using the gold linker  (Peter Geoghegan <pg@bowt.ie>)
Responses Re: small development tip: Consider using the gold linker  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-hackers
Hi,

On 2022-01-13 19:24:09 -0800, Peter Geoghegan wrote:
> On Fri, Jul 20, 2018 at 8:16 PM Peter Geoghegan <pg@bowt.ie> wrote:
> > On Mon, Jul 9, 2018 at 4:40 PM, Andres Freund <andres@anarazel.de> wrote:
> > > FWIW, I've lately noticed that I spend a fair time waiting for the
> > > linker during edit-compile-test cycles.  Due to an independent issue I
> > > just used the gold linker, and the speedup is quite noticable.
> > > For me just adding '-fuse-ld=gold' to CFLAGS works.
> >
> > I tried this out today. It makes quite a noticeable difference for me.
> > Thanks for the tip.
> 
> The 2022 version of the same tip: switching over to LLVM lld seems to
> offer a further significant speedup over gold. Not surprising, since
> lld is specifically promoted as a linker that is faster than gold [1].

I've switched back and forth between gold and lld a couple times. Eventually I
always get frustrated by lld causing slowdowns and other issues for gdb. Did
you ever hit one of those?


> Again, this appears to just be a case of installing lld, and adding
> '-fuse-ld=lld' to CFLAGS -- a very easy switch to make. Link time is
> still a noticeable contributor to overall build time for me, even with
> gold (I use ccache, of course).

Yea. gold also isn't really maintained anymore, so it'd be nice to move on...


> There is another linker called mold [2]. It claims to be faster than
> lld (which was faster than gold, which was faster than ld). I didn't
> bother trying it out.

Yea, didn't yet quite seem there yet last time I looked, and lld seems plenty
fast for our purposes.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: postgres_fdw: using TABLESAMPLE to collect remote sample
Next
From: Jacob Champion
Date:
Subject: Re: pgcrypto: Remove internal padding implementation