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) {
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 } ;
You can’t perform that action at this time.
0 commit comments