Use `std:🧵:available_parallelism` in place of num_cpus (#199)

This commit is contained in:
Josh Triplett 2022-04-29 10:11:02 -07:00 committed by GitHub
parent 288e213c78
commit 94b49a2d60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 3 deletions

View File

@ -18,7 +18,6 @@ raw-api = []
send_guard = ["parking_lot/send_guard"]
[dependencies]
num_cpus = "1.13.1"
parking_lot = "0.12.0"
hashbrown = "0.11.2"
serde = { version = "1.0.136", optional = true, features = ["derive"] }

View File

@ -1,4 +1,4 @@
[toolchain]
channel = "stable-2020-12-31"
channel = "1.59"
components = [ "rustfmt", "clippy" ]
profile = "minimal"

View File

@ -46,7 +46,7 @@ cfg_if! {
pub(crate) type HashMap<K, V, S> = hashbrown::HashMap<K, SharedValue<V>, S>;
fn default_shard_amount() -> usize {
(num_cpus::get() * 4).next_power_of_two()
(std::thread::available_parallelism().map_or(1, usize::from) * 4).next_power_of_two()
}
fn ncb(shard_amount: usize) -> usize {