@@ -32,21 +32,21 @@ fn derive_default_threads(threads: usize) -> usize {
3232/// On everything else, it's usually a good idea to use as many threads as possible for noticeable speedups.
3333#[ cfg( all( target_os = "macos" , target_arch = "aarch64" ) ) ]
3434fn derive_default_threads ( threads : usize ) -> usize {
35- use sysinfo:: { ProcessorExt , RefreshKind , SystemExt } ;
35+ use sysinfo:: { CpuExt , CpuRefreshKind } ;
36+ use sysinfo:: { RefreshKind , SystemExt } ;
3637 if threads == 0 {
37- sysinfo:: System :: new_with_specifics ( RefreshKind :: new ( ) . with_cpu ( ) )
38- . processors ( )
39- . get ( 0 )
40- . map_or ( 0 , |p| match p . brand ( ) {
41- "Apple M1" | "Apple M1 Pro" | "Apple M1 Max" | "Apple M2" => 4 ,
42- other => {
43- eprintln ! (
38+ let system = sysinfo:: System :: new_with_specifics (
39+ RefreshKind :: new ( ) . with_cpu ( CpuRefreshKind :: default ( ) ) ,
40+ ) ;
41+ if system . global_cpu_info ( ) . brand ( ) . starts_with ( "Apple M" ) {
42+ 4
43+ } else {
44+ eprintln ! (
4445 "Couldn't auto-configure correct amount of threads for {}. Create an issue here: https://github.com/byron/dua-cli/issues" ,
45- other
46+ system . global_cpu_info ( ) . brand ( )
4647 ) ;
47- 0
48- }
49- } )
48+ 0
49+ }
5050 } else {
5151 threads
5252 }
@@ -57,6 +57,7 @@ fn main() -> Result<()> {
5757
5858 let opt: options:: Args = options:: Args :: parse_from ( wild:: args_os ( ) ) ;
5959 let threads = derive_default_threads ( opt. threads ) ;
60+ dbg ! ( threads) ;
6061 let walk_options = dua:: WalkOptions {
6162 threads,
6263 byte_format : opt. format . into ( ) ,
0 commit comments