Skip to content

Commit f333903

Browse files
Nadrierilmark-i-m
authored andcommitted
Suggest selectively disabling optimizations
1 parent eb07bea commit f333903

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/building/suggested.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,22 @@ You can also use `--keep-stage 1` when running tests. Something like this:
8787
- Initial test run: `./x.py test -i --stage 1 src/test/ui`
8888
- Subsequent test run: `./x.py test -i --stage 1 src/test/ui --keep-stage 1`
8989

90+
## Fine-tuning optimizations
91+
92+
Setting `optimize = false` makes the compiler too slow for tests. However, to
93+
improve the test cycle, you can disable optimizations selectively only for the
94+
crates you'll have to rebuild
95+
([source](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/incremental.20compilation.20question/near/202712165)).
96+
For example, when working on `rustc_mir_build`, the `rustc_mir_build` and
97+
`rustc_driver` crates take the most time to incrementally rebuild. You could
98+
therefore set the following in the root `Cargo.toml`:
99+
```toml
100+
[profile.release.package.rustc_mir_build]
101+
opt-level = 0
102+
[profile.release.package.rustc_driver]
103+
opt-level = 0
104+
```
105+
90106
## Working on multiple branches at the same time
91107

92108
Working on multiple branches in parallel can be a little annoying, since

0 commit comments

Comments
 (0)