Use as many threads as logical cores for achieving full utilization (#1897)

This commit is contained in:
Cijo Thomas 2024-06-27 13:25:04 -07:00 committed by GitHub
parent 4df74e85ef
commit d54c18b80c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -42,5 +42,5 @@ Throughput: 5,075,400 iterations/sec
"stats" - Prints memory and CPU usage. Has slight impact on throughput. "stats" - Prints memory and CPU usage. Has slight impact on throughput.
```sh ```sh
cargo run --release --bin metrics --feature=stats cargo run --release --bin metrics --features=stats
``` ```

View File

@ -126,7 +126,7 @@ where
handles.push(handle_main_thread); handles.push(handle_main_thread);
for thread_index in 0..num_threads - 1 { for thread_index in 0..num_threads {
let worker_stats_shared = Arc::clone(&worker_stats_shared); let worker_stats_shared = Arc::clone(&worker_stats_shared);
let func_arc_clone = Arc::clone(&func_arc); let func_arc_clone = Arc::clone(&func_arc);
let handle = thread::spawn(move || loop { let handle = thread::spawn(move || loop {