Skip to content

Commit 3a58b2b

Browse files
committed
Let tidy use more threads
This has a significant speedup for me locally, from about 1.3 seconds to .9 seconds.
1 parent 19b272a commit 3a58b2b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/bootstrap/test.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,11 @@ impl Step for Tidy {
11181118
cmd.arg(&builder.src);
11191119
cmd.arg(&builder.initial_cargo);
11201120
cmd.arg(&builder.out);
1121-
cmd.arg(builder.jobs().to_string());
1121+
// Tidy is heavily IO constrained. Still respect `-j`, but use a higher limit if `jobs` hasn't been configured.
1122+
let jobs = builder.config.jobs.unwrap_or_else(|| {
1123+
8 * std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get) as u32
1124+
});
1125+
cmd.arg(jobs.to_string());
11221126
if builder.is_verbose() {
11231127
cmd.arg("--verbose");
11241128
}

0 commit comments

Comments
 (0)