Skip to content

Commit bb5f9d1

Browse files
committed
lintcheck: tweak some comments
1 parent 90d3275 commit bb5f9d1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

clippy_dev/src/lintcheck.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,21 +472,23 @@ pub fn run(clap_config: &ArgMatches) {
472472
} else {
473473
let counter = std::sync::atomic::AtomicUsize::new(0);
474474

475-
// Ask rayon for cpu (actually thread)count.
476-
// Use one target dir for each cpu so that we can run N clippys in parallel.
475+
// Ask rayon for thread count. Assume that half of that is the number of physical cores
476+
// Use one target dir for each core so that we can run N clippys in parallel.
477477
// We need to use different target dirs because cargo would lock them for a single build otherwise,
478478
// killing the parallelism. However this also means that deps will only be reused half/a
479479
// quarter of the time which might result in a longer wall clock runtime
480480

481-
// Rayon seems to return thread count so half that for core count
481+
// This helps when we check many small crates with dep-trees that don't have a lot of branches in
482+
// order to achive some kind of parallelism
482483

483-
let num_threads: usize = rayon::current_num_threads() / 2;
484+
// Rayon seems to return thread count so half that for core count
485+
let num_cpus: usize = rayon::current_num_threads() / 2;
484486

485487
// check all crates (default)
486488
crates
487489
.into_par_iter()
488490
.map(|krate| krate.download_and_extract())
489-
.map(|krate| krate.run_clippy_lints(&cargo_clippy_path, &counter, num_threads))
491+
.map(|krate| krate.run_clippy_lints(&cargo_clippy_path, &counter, num_cpus))
490492
.flatten()
491493
.collect()
492494
};

0 commit comments

Comments
 (0)