File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -472,21 +472,23 @@ pub fn run(clap_config: &ArgMatches) {
472
472
} else {
473
473
let counter = std:: sync:: atomic:: AtomicUsize :: new ( 0 ) ;
474
474
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.
477
477
// We need to use different target dirs because cargo would lock them for a single build otherwise,
478
478
// killing the parallelism. However this also means that deps will only be reused half/a
479
479
// quarter of the time which might result in a longer wall clock runtime
480
480
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
482
483
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 ;
484
486
485
487
// check all crates (default)
486
488
crates
487
489
. into_par_iter ( )
488
490
. 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 ) )
490
492
. flatten ( )
491
493
. collect ( )
492
494
} ;
You can’t perform that action at this time.
0 commit comments