-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Use -Z threads=0
option in config_fast_builds.toml
#11541
Merged
alice-i-cecile
merged 2 commits into
bevyengine:main
from
doonv:config-fast-builds-threads
Jan 29, 2024
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ linker = "clang" | |
rustflags = [ | ||
"-Clink-arg=-fuse-ld=lld", # Use LLD Linker | ||
"-Zshare-generics=y", # (Nightly) Make the current crate share its generic instantiations | ||
"-Zthreads=8", # (Nightly) Use improved multithreading with 8 threads. | ||
] | ||
|
||
# NOTE: you must install [Mach-O LLD Port](https://lld.llvm.org/MachO/index.html) on mac. you can easily do this by installing llvm which includes lld with the "brew" package manager: | ||
|
@@ -16,6 +17,7 @@ rustflags = [ | |
rustflags = [ | ||
"-Clink-arg=-fuse-ld=/usr/local/opt/llvm/bin/ld64.lld", # Use LLD Linker | ||
"-Zshare-generics=y", # (Nightly) Make the current crate share its generic instantiations | ||
"-Zthreads=8", # (Nightly) Use improved multithreading with 8 threads. | ||
] | ||
|
||
[target.aarch64-apple-darwin] | ||
|
@@ -25,8 +27,11 @@ rustflags = [ | |
] | ||
|
||
[target.x86_64-pc-windows-msvc] | ||
linker = "rust-lld.exe" # Use LLD Linker | ||
rustflags = ["-Zshare-generics=n"] | ||
linker = "rust-lld.exe" # Use LLD Linker | ||
rustflags = [ | ||
"-Zshare-generics=n", | ||
"-Zthreads=8", # (Nightly) Use improved multithreading with 8 threads. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Windows users should also test this out |
||
] | ||
|
||
# Optional: Uncommenting the following improves compile times, but reduces the amount of debug info to 'line number tables only' | ||
# In most cases the gains are negligible, but if you are on macos and have slow compile times you should see significant gains. | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can any MacOS users test if this works well? It might reduce performance on MacOS or even not work at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After testing it on my M1 Mac, this option actually seems to slow down the compilation process. I built with the
--timings
option to generate the following charts. The time increases from 58.4 seconds to 63.6 seconds.Before:
After:
Edit: Redid timings so the only difference between "Before" and "After" was commenting out
-Zthreads=0
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an average or just one test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was just one test. Here's my results running
cargo clean && cargo +nightly build
with and without-Zthreads=0
commented out.Before
Average: 1:06.05s
After
Average: 1:11.29s