deadpool/
util.rs

1lazy_static::lazy_static! {
2    /// Cache the physical CPU count to avoid calling `num_cpus::get()`
3    /// multiple times, which is expensive when creating pools in quick
4    /// succession.
5    static ref CPU_COUNT: usize = num_cpus::get();
6}
7
8/// Get the default maximum size of a pool, which is `cpu_core_count * 2`
9/// including logical cores (Hyper-Threading).
10pub(crate) fn get_default_pool_max_size() -> usize {
11    *CPU_COUNT * 2
12}