Monday, June 6, 2016

Multithreaded linking with ld.gold, currently minimal benefit

When properly using ‘make’ with a large development tress, I generally find the single largest bottleneck during compilation quickly becomes the linking stage. While most distributions, including CentOS 7, now include ld.gold for a substantially performance boost over the traditional ld, faster performance would always be benefitial. Imagine my excitement when I learned that ld.gold has a multithreaded mode as a possible way in increase speed without new hardware!  However by default ld.gold (part of binutils) is built with it disabled under Centos 7
ld.gold --threads
ld.gold: warning: ignoring --threads: ld.gold was compiled without thread support
GNU gold (version 2.23.52.0.1-55.el7 20130226) 1.11
Originally I though this entry would end up being a recipe on how to rebuild binutils from an srpm with the “--enable-threads” to enable multithreaded. Unfortunately, after testing this myself and some informal benchmarking with 4 threads, the actually speed increase was only about 1-2% - not worth the possible side effects in my opinion. That said the version of binutils/gold included with CentOS 7 is heavily patched and a few versions behind, so it’s possible a newer/vanilla version of ld.gold might benefit greater benefit in threaded mode. In particular devtoolsset-4 from Software Collection comes with a more vanilla ld.gold 2.25, so once I’m ready to move to gcc 5.2 I might conduct this experiment again.  Finally, if you have seen differnet behavior with multithreaded ld.gold I would love to hear about it.

No comments:

Post a Comment