Skip to content

Commit e819f9e

Browse files
authored
chore(benches): use std instead num_cpu (#11338)
1 parent 7cd93eb commit e819f9e

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benches/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ tokio = { workspace = true, features = ["full"] }
2222
chrono = { version = "0.4", features = ["serde"] }
2323
rayon.workspace = true
2424
clap = { version = "4", features = ["derive"] }
25-
num_cpus = "1.17"
2625
once_cell = "1.21"
2726

2827
[dev-dependencies]

benches/src/results.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::RepoConfig;
22
use eyre::Result;
33
use serde::{Deserialize, Serialize};
4-
use std::{collections::HashMap, process::Command};
4+
use std::{collections::HashMap, process::Command, thread};
55

66
/// Hyperfine benchmark result
77
#[derive(Debug, Deserialize, Serialize)]
@@ -131,7 +131,10 @@ impl BenchmarkResults {
131131
// System info
132132
output.push_str("## System Information\n\n");
133133
output.push_str(&format!("- **OS**: {}\n", std::env::consts::OS));
134-
output.push_str(&format!("- **CPU**: {}\n", num_cpus::get()));
134+
output.push_str(&format!(
135+
"- **CPU**: {}\n",
136+
thread::available_parallelism().map_or(1, |n| n.get())
137+
));
135138
output.push_str(&format!(
136139
"- **Rustc**: {}\n",
137140
get_rustc_version().unwrap_or_else(|_| "unknown".to_string())

0 commit comments

Comments
 (0)