2019-09-12 11:39:39 -07:00
|
|
|
#[macro_use]
|
|
|
|
extern crate lazy_static;
|
|
|
|
|
|
|
|
//TODO remove this hack when rayon fixes itself
|
2019-09-18 18:00:07 -07:00
|
|
|
|
2019-09-12 11:39:39 -07:00
|
|
|
lazy_static! {
|
2019-10-17 20:55:05 -07:00
|
|
|
// reduce the number of threads each pool is allowed to half the cpu core count, to avoid rayon
|
|
|
|
// hogging cpu
|
2020-03-16 12:53:13 -07:00
|
|
|
static ref MAX_RAYON_THREADS: usize = num_cpus::get() as usize / 2;
|
2019-09-12 11:39:39 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_thread_count() -> usize {
|
2019-10-17 20:55:05 -07:00
|
|
|
*MAX_RAYON_THREADS
|
2019-09-12 11:39:39 -07:00
|
|
|
}
|