This more than doubled the speed of my builds for my average size project for hxcpp on Linux (with
-debug). I post this for independant developers like me, because bigger teams with specialists surely are very far ahead in the game.
Observing my compilation times for some days, I remarked while
gcc were taking a few seconds, the last stage -the linking-, was taking about 10 times that amount of time! Observing with something like
htop, we can see
gcc is using all the cores of the CPU, while
ld only uses one.
lld is a drop-in replacement for
ld. It is the LLVM project linker, it uses multiple cores and is very much faster (for some big projects in debug mode it is reported it links at 10 times the speed of
ld, though 2 times the speed is a more prudent expectation).
Since it’s a drop-in for
ld; this means it is perfectly compatible with it, option by option, and thus that it is usable by hxcpp.
The good thing is you don’t need to uninstall
ld, you can simply install
lld and put a symbolic link in a folder of your
$PATH having a better priority to where
ld actually sits (e.g.
For example on Archlinux:
pacman -S lld
cd /usr/local/bin; ln -s /usr/bin/lld ld
haxe build.hxml --times
Is enough. If at one point you don’t want
lld anymore you can just remove the symlinks and it will use the classical
(This will likely only help you if there is a disproportionate linking time as opposed to compilation time, i.e. compare the two first lines of
haxe build.hxml --times, I don’t think this will be the case for all projects. The case where it would help most IMO is
-debug + many libs).