4 ms·
Gold is much better than a 30% speedup IME. I went from >60 seconds per (config x arch x platform x near-leaf binary) combination with bfd, to <10 with gold, o
by MaulingMonkey 6y ago
Gold is much better than a 30% speedup IME. I went from >60 seconds per (config x arch x platform x near-leaf binary) combination with bfd, to <10 with gold, on one Android project - even without enabling incremental linking (>6x faster / <16% original link time!). Enough to shift the bottleneck to packaging/signing APKs on that project...
Additionally, I'll note that gold's incremental linking is in-place binary patching, from what I can tell, and potentially another order-of-magnitude speedup even on your existing C projects - slide 11+ certainly appears to be describing such, and the caveats + resulting overhead: https://events.static.linuxfound.org/images/stories/pdf/lfcs2012_ccoutant.pdf https://events.static.linuxfound.org/images/stories/pdf/lfcs...
(slide 17 also shows --incremental-base, if you decide you want non-in-place incremental linking)
- benesch 6y agoWere you working on a C/C++ project, out of curiosity? Of the two projects I've meaningfully benchmarked gold on, one was written in Rust and one was written in Go. I can believe that the Rust/Go toolchains make life difficult enough for gold that there is less of a speedup realized. And yeah, the `--incremental` support in gold is definitely very exciting. Unfortunately it is not complete enough that I've been able to use it on any of the projects where it would matter. Part of what gets me so excited about having first-class support in Zig is that it will work end-to-end, and adjust folks' expectations of how fast linking should be. Then those folks will go demand the same linking speeds of their C/C++/Rust/Go projects. Building incremental support into LLVM/gcc/gold is definitely the long-term answer, but building an end-to-end incremental toolchain in Zig from scratch to prove the concept makes a ton of sense.
- MaulingMonkey 6y ago> Were you working on a C/C++ project, out of curiosity? Yes. My numbers are for a somewhat template heavy C++ project. I could see Rust/Go having different performance characteristics on that front.
- Ar-Curunir 6y agolld seems to reduce rust linking time significantly: * 2x for linking rustc: https://blog.mozilla.org/nnethercote/2020/04/24/how-to-speed-up-the-rust-compiler-in-2020/ https://blog.mozilla.org/nnethercote/2020/04/24/how-to-speed... * 3x here: https://brokenco.de/2020/01/08/faster-rust-linking.html https://brokenco.de/2020/01/08/faster-rust-linking.html * 2x faster than gold according to this: https://github.com/rust-lang/rust/issues/71515 https://github.com/rust-lang/rust/issues/71515
- ndesaulniers 6y agoHave you tried LLD; LLD beat the crap out of Gold IME.
- MaulingMonkey 6y agoNot yet on a large enough project that I'd be able to tell. It's on my radar for the next time I find myself in that position though!