Decrease Duniter build time

@tuxmain could you share the way you decreased Duniter build time?

The GNU linker ld is not parallelized, so you can observe that at the very end of the compilation, cargo spends a lot of time using only one core. One way to speed up linking is to use mold instead, which is parallelized and more efficient.

You can build it yourself, install a package or download a release from GitHub:

(if you don’t have the package, move the binary to /usr/bin/mold)

Then add this to ~/.cargo/config:

linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=/usr/bin/mold"]

(change the target if needed) (you may need to install clang)

To save storage, I recommend to do rm -r target in your Rust project directories before rebuilding them with this new config.

Edit: This affects all the cargo builds to this target by the user, not only Duniter.

1 Like
sudo pacman -S mold

Thanks a lot!

note to myself: add this to Duniter doc