Performance Benchmark: ripgrep Linking Time Comparison (GNU ld vs rust-lld)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi all,
As part of evaluation of linker performance improvements in Rust-based builds, I conducted a comparative analysis of *GNU ld* and *rust-lld* using the ripgrep v14.1.1 crate.
This analysis found similar reduction in link time of ~5x vs ~7x reported in the Rust blog post <https://urldefense.com/v3/__https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux/__;!!AjveYdw8EvQ!YH3BMPtBzXIQDLcJ56Wco9HkQ1Z8LqPnv92YlUEJ9k0GU0MP8eBgC-yI5bjzIxbzIlc-2-_VUtmcnp0OG402BSIyOWh6pvY$> that highlighted rust-lld’s impact on reducing linking time for ripgrep.
Here's the summary of the performance results:
Steps followed:
1. Prepared the poky SDK env with nightly rust and cargo included.
2. Invoke the SDK env.
3. Clone ripgrep crate.
4. Run RUSTFLAGS="-Clinker-features=-lld" cargo +nightly build -Zsection-timings --timings and cargo +nightly build -Zsection-timings --timings
5. This generates the attached result files. Compared the performance result.
* *Test Setup:*
* *Target crate:* ripgrep v14.1.1
* *Compiler:* rustc 1.91.0-nightly (f2824da98 2025-08-28)
* *Platform:* Linux (Host: x86_64-unknown-linux-gnu, Target:
x86_64-poky-linux-gnu)
* *Comparison:* rust-lld (LLVM linker) vs GNU ld (default linker)
*
*
*Metric*
*With GNU ld*
*With rust-lld*
*Difference*
*Total build time*
6.0s
3.9s
*~35% faster*
*Link time*
2.1s (35%)
0.4s (10%)
*~5.25x faster*
*Frontend Time*
1.5s (25%)
1.3s (34%)
**
*Codegen Time*
2.4s (40%)
2.2s (56%)
**
*
*
* *Key Observations:*
*Link Time Performance:*
* Switching to rust-lld *reduced* the linking time *from 2.1s to 0.4s, a ~5.25x* improvement.
* Link stage *dropped from 35% to 10% *of the total build time.
* The link time improvement (5.25 reduction) aligns closely with the *"7x reduction"* reported in the Rust Blog (May 2024)
<https://urldefense.com/v3/__https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux/__;!!AjveYdw8EvQ!YH3BMPtBzXIQDLcJ56Wco9HkQ1Z8LqPnv92YlUEJ9k0GU0MP8eBgC-yI5bjzIxbzIlc-2-_VUtmcnp0OG402BSIyOWh6pvY$>.
**
*Total Build Time:*
* The total time to build the ripgrep crate *decreased by ~35% (from 6.0s → 3.9s)*.
* While codegen and frontend times remain relatively *similar*, the reduced link time brings meaningful end-to-end gains.
* The overall ripgrep crate build time is *reduced to 11.9s from 18s (33.3% faster)*.
*System Utilization:*
* Based on the build timing graphs, CPU usage during link time appears more efficient with rust-lld.**
* It indicates earlier tail-off of active work in the lld build, reflecting the faster conclusion of linking.
Please find attached result files for ripgrep build performance using GNU ld and rust-lld.
The performace improvements observed are consistent with the results reported in the rust blog, under full or clean builds. While the frontend and codegen build timings are similar, rust-lld demonstrates slightly better overall link performance and smoother CPU usage. Minor variations in exact timings can be due to other processes running concurrently on the shared machine resource used by multiple users.
Regards,
Yash
Quoted 5 lines · Yash Shinde via lists.openembedded.org
As part of evaluation of linker performance improvements in Rust-based builds, I conducted a comparative analysis of GNU ld and rust-lld using the ripgrep v14.1.1 crate.
This analysis found similar reduction in link time of ~5x vs ~7x reported in the Rust blog post that highlighted rust-lld’s impact on reducing linking time for ripgrep.
Very interesting, thanks Yash.
Is ‘rust-lld’ actually just upstream lld from LLVM? We have a recipe for that, so if in the future we move our rust from rust-llvm.bb to llvm.bb then I hope we could just use our lld.bb too?
Cheers,
Ross
Quoted 9 lines · Ross Burton
Quoted 5 lines · Yash Shinde via lists.openembedded.org
As part of evaluation of linker performance improvements in Rust-based builds, I conducted a comparative analysis of GNU ld and rust-lld using the ripgrep v14.1.1 crate.
This analysis found similar reduction in link time of ~5x vs ~7x reported in the Rust blog post that highlighted rust-lld’s impact on reducing linking time for ripgrep.
Very interesting, thanks Yash.
Is ‘rust-lld’ actually just upstream lld from LLVM? We have a recipe for that, so if in the future we move our rust from rust-llvm.bb to llvm.bb then I hope we could just use our lld.bb too?
Yes, rust-lld is a renamed lld from LLVM. Perhaps, we could use it if there are no regressions.
Deepesh has worked on dropping rust-llvm and tested the builds with LLVM 21.1.0 successfully.
https://lists.openembedded.org/g/openembedded-core/topic/remove_rust_llvm_dependency/115274198
However, rust upstream has disabled lld as default due some known issues for the dist sources. It's seems to be unstable with some distributions for now.
https://github.com/rust-lang/rust/pull/143255
Regards,
Yash.
Quoted 3 lines
Cheers,
Ross
Signature · 2 lines
Regards, Yash Shinde