File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ async-channel = "1.4.1"
2727async-io = " 1.1.9"
2828criterion = { version = " 0.4.0" , default-features = false , features = [" cargo_bench_support" ] }
2929easy-parallel = " 3.1.0"
30- num_cpus = " 1.13.0"
3130once_cell = " 1.16.0"
3231
3332[[bench ]]
Original file line number Diff line number Diff line change 11use std:: future:: Future ;
2+ use std:: thread:: available_parallelism;
23
34use async_executor:: Executor ;
45use criterion:: { criterion_group, criterion_main, Criterion } ;
@@ -11,7 +12,11 @@ const LIGHT_TASKS: usize = 25_000;
1112static EX : Executor < ' _ > = Executor :: new ( ) ;
1213
1314fn run ( f : impl FnOnce ( ) , multithread : bool ) {
14- let limit = if multithread { num_cpus:: get ( ) } else { 1 } ;
15+ let limit = if multithread {
16+ available_parallelism ( ) . unwrap ( ) . get ( )
17+ } else {
18+ 1
19+ } ;
1520
1621 let ( s, r) = async_channel:: bounded :: < ( ) > ( 1 ) ;
1722 easy_parallel:: Parallel :: new ( )
You can’t perform that action at this time.
0 commit comments