-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch from ld (the default linker) to using lld for GNU Linux targets #8166
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
**What's wrong with `ld`?** It's very slow and uses a lot of memory. **Why `lld`?** It's fast, mature, and well-supported. Meta and Google use it for all their linking workloads. We're already using it for macos and x86-64 Windows. There is [ongoing work to make it the default for rustc](rust-lang/rust#71515), and it already is default on a few platforms. **Why not `mold`?** Mold is generally faster, but the margin is slim enough for our workloads that it doesn't really matter. Mold only recently got support for LTO, doesn't support v0 rust symbol demanging, doesn't support BOLT (though we don't use that yet), etc. Mold is maturing quickly, but `lld` still seems like the "safer" choice.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
9 Ignored Deployments
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
bgw
requested review from
a team,
tknickman and
chris-olszewski
and removed request for
a team
May 17, 2024 03:19
🟢 Turbopack Benchmark CI successful 🟢Thanks |
✅ This change can build |
|
kdy1
approved these changes
May 17, 2024
bgw
added a commit
to vercel/next.js
that referenced
this pull request
May 17, 2024
bgw
added a commit
to vercel/next.js
that referenced
this pull request
May 17, 2024
Neosoulink
pushed a commit
to Neosoulink/turbo
that referenced
this pull request
Jun 14, 2024
vercel#8166) **What's wrong with `ld`?** It's very slow and uses a lot of memory. **Why `lld`?** It's fast, mature, and well-supported. Meta and Google use it for all their linking workloads. We're already using it for macos and x86-64 Windows. There is [ongoing work to make it the default for rustc](rust-lang/rust#71515), and it already is default on a few platforms. **Why not `mold`?** Mold is generally faster, but the margin is slim enough for our workloads that it doesn't really matter. Mold only recently got support for LTO, doesn't support v0 rust symbol demanging, doesn't support BOLT (though we don't use that yet), etc. Mold is maturing quickly, but `lld` still seems like the "safer" choice.
bgw
added a commit
to vercel/next.js
that referenced
this pull request
Jul 3, 2024
bgw
added a commit
to vercel/next.js
that referenced
this pull request
Aug 4, 2024
mischnic
pushed a commit
to vercel/next.js
that referenced
this pull request
Aug 5, 2024
bgw
added a commit
to vercel/next.js
that referenced
this pull request
Aug 5, 2024
bgw
added a commit
to vercel/next.js
that referenced
this pull request
Aug 6, 2024
#65898) Copies changes from vercel/turborepo#8166, and updates contributing documentation to include the installation of lld. > **What's wrong with `ld`?** It's very slow and uses a lot of memory. > > **Why `lld`?** It's fast, mature, and well-supported. Meta and Google use it for all their linking workloads. We're already using it for macos and x86-64 Windows. There is [ongoing work to make it the default for rustc](rust-lang/rust#71515), and it already is default on a few platforms. > > **Why not `mold`?** Mold is generally faster, but the margin is slim enough for our workloads that it doesn't really matter. Mold only recently got support for LTO, doesn't support v0 rust symbol demanging, doesn't support BOLT (though we don't use that yet), etc. Mold is maturing quickly, but `lld` still seems like the "safer" choice.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's wrong with
ld
? It's very slow and uses a lot of memory.Why
lld
? It's fast, mature, and well-supported. Meta and Google use it for all their linking workloads. We're already using it for macos and x86-64 Windows. There is ongoing work to make it the default for rustc, and it already is default on a few platforms.Why not
mold
? Mold is generally faster, but the margin is slim enough for our workloads that it doesn't really matter. Mold only recently got support for LTO, doesn't support v0 rust symbol demanging, doesn't support BOLT (though we don't use that yet), etc. Mold is maturing quickly, butlld
still seems like the "safer" choice.Benchmark Caveats
This is using https://github.com/bgw/benchmark-scripts. That machine has a bunch of CPU cores disabled, so the benchmark is running on 4 cores without SMT. With higher core/thread counts, mold will almost certainly perform better as it's heavily multi-threaded. However, I think these benchmarks do enough to show that the real enemy is
ld
, andlld
is close enough tomold
.Turbopack Warm Build
Modify a string in an error message inside of
crates/turbopack-ecmascript/src/minify.rs
. This guarantees forced recompilation of all dependent crates without meaninfully changing any behavior. Then run:With GNU ld (2.40)
Without RUSTFLAGS
With Mold (1.10.1, Debian 12)
Using
RUSTFLAGS=-Clink-arg=-fuse-ld=mold
With LLD (14.0.6, Debian 12)
Using
RUSTFLAGS=-Clink-arg=-fuse-ld=lld
Turbopack Cold Build
With GNU ld (2.40)
Without RUSTFLAGS
With Mold (1.10.1, Debian 12)
Using
RUSTFLAGS=-Clink-arg=-fuse-ld=mold
With LLD (14.0.6, Debian 12)
Using
RUSTFLAGS=-Clink-arg=-fuse-ld=lld
Turborepo Cold Build
With GNU ld (2.40)
Without RUSTFLAGS
With Mold (1.10.1, Debian 12)
Using
RUSTFLAGS=-Clink-arg=-fuse-ld=mold
With LLD (14.0.6, Debian 12)
Using
RUSTFLAGS=-Clink-arg=-fuse-ld=lld
Tests Cold Build
This produces a large number of binary targets in parallel.
With GNU ld (2.40)
Without RUSTFLAGS
No numbers, as this OOMs (!!!) (16GB of RAM)
With Mold (1.10.1, Debian 12)
Using
RUSTFLAGS=-Clink-arg=-fuse-ld=mold
With LLD (14.0.6, Debian 12)
Using
RUSTFLAGS=-Clink-arg=-fuse-ld=lld