mold and wild enable several tricks by default that other linkers don't do. This post looks at three of them:
- overwrite an existing output file in place instead of creating a new file
- fork a child to do the link, so that the parent can exit before the child releases its memory
- ask the kernel for transparent huge pages
Each saves a few percent of wall time in an edit-relink loop. Each also breaks an assumption that build systems, debuggers, and profilers make about a process. I measured what they save and what they break.
Setup: Linux 6.18, i7-14700K (28 threads), ext4 on a SATA SSD,
transparent huge pages enabled=always. GNU ld 2.47, gold
2.47, LLD 23, mold 2.42.1 (TODO: I used the Rust port under development;
check against the C++ release), wild at commit 47cc8e8e.