diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-03-18 12:04:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-18 12:04:21 +0100 |
| commit | 7ebf2cd2b8f1f8c11f9339ef337d336a91d6f7dc (patch) | |
| tree | 599c1fff28765ed61a3acb84485935c9c2417d04 /src/bootstrap | |
| parent | 9599f3cc5430039b615bc5171be41a6733083dc0 (diff) | |
| parent | 675c4aa2c1c142415d4e95bf550ec0b1de2493d0 (diff) | |
| download | rust-7ebf2cd2b8f1f8c11f9339ef337d336a91d6f7dc.tar.gz rust-7ebf2cd2b8f1f8c11f9339ef337d336a91d6f7dc.zip | |
Rollup merge of #108772 - jyn514:faster-tidy, r=the8472
Speed up tidy quite a lot I highly recommend reviewing this commit-by-commit. Based on #106440 for convenience. ## Timings These were collected by running `x test tidy -v` to copy paste the command, then using [`samply record`](https://github.com/mstange/samply). before (8 threads)  after (8 threads)  before (64 threads)  after (64 threads)  The last commit makes tidy use more threads, so comparing "before (8 threads)" to "after (64 threads)" is IMO the most realistic comparison. Locally, that brings the time for me to run tidy down from 4 to .9 seconds, i.e. the majority of the time for `x test tidy` is now spend running `fmt --check`. r? `@the8472`
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/test.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index f5d680df113..baddc9da48d 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1118,7 +1118,11 @@ impl Step for Tidy { cmd.arg(&builder.src); cmd.arg(&builder.initial_cargo); cmd.arg(&builder.out); - cmd.arg(builder.jobs().to_string()); + // Tidy is heavily IO constrained. Still respect `-j`, but use a higher limit if `jobs` hasn't been configured. + let jobs = builder.config.jobs.unwrap_or_else(|| { + 8 * std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get) as u32 + }); + cmd.arg(jobs.to_string()); if builder.is_verbose() { cmd.arg("--verbose"); } |
