mirror of https://github.com/xacrimon/dashmap
Use `std:🧵:available_parallelism` in place of num_cpus (#199)
This commit is contained in:
parent
288e213c78
commit
94b49a2d60
|
@ -18,7 +18,6 @@ raw-api = []
|
||||||
send_guard = ["parking_lot/send_guard"]
|
send_guard = ["parking_lot/send_guard"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
num_cpus = "1.13.1"
|
|
||||||
parking_lot = "0.12.0"
|
parking_lot = "0.12.0"
|
||||||
hashbrown = "0.11.2"
|
hashbrown = "0.11.2"
|
||||||
serde = { version = "1.0.136", optional = true, features = ["derive"] }
|
serde = { version = "1.0.136", optional = true, features = ["derive"] }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "stable-2020-12-31"
|
channel = "1.59"
|
||||||
components = [ "rustfmt", "clippy" ]
|
components = [ "rustfmt", "clippy" ]
|
||||||
profile = "minimal"
|
profile = "minimal"
|
||||||
|
|
|
@ -46,7 +46,7 @@ cfg_if! {
|
||||||
pub(crate) type HashMap<K, V, S> = hashbrown::HashMap<K, SharedValue<V>, S>;
|
pub(crate) type HashMap<K, V, S> = hashbrown::HashMap<K, SharedValue<V>, S>;
|
||||||
|
|
||||||
fn default_shard_amount() -> usize {
|
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 {
|
fn ncb(shard_amount: usize) -> usize {
|
||||||
|
|
Loading…
Reference in New Issue