(cherry picked from commit 37222683ee)
Co-authored-by: sakridge <sakridge@gmail.com>
			
			
This commit is contained in:
		@@ -1,12 +1,16 @@
 | 
				
			|||||||
#[macro_use]
 | 
					#[macro_use]
 | 
				
			||||||
extern crate lazy_static;
 | 
					extern crate lazy_static;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use std::env;
 | 
				
			||||||
//TODO remove this hack when rayon fixes itself
 | 
					//TODO remove this hack when rayon fixes itself
 | 
				
			||||||
 | 
					
 | 
				
			||||||
lazy_static! {
 | 
					lazy_static! {
 | 
				
			||||||
    // reduce the number of threads each pool is allowed to half the cpu core count, to avoid rayon
 | 
					    // reduce the number of threads each pool is allowed to half the cpu core count, to avoid rayon
 | 
				
			||||||
    // hogging cpu
 | 
					    // hogging cpu
 | 
				
			||||||
    static ref MAX_RAYON_THREADS: usize = num_cpus::get() as usize / 2;
 | 
					    static ref MAX_RAYON_THREADS: usize =
 | 
				
			||||||
 | 
					            env::var("SOLANA_RAYON_THREADS")
 | 
				
			||||||
 | 
					                .map(|x| x.parse().unwrap_or(num_cpus::get() as usize / 2))
 | 
				
			||||||
 | 
					                .unwrap_or(num_cpus::get() as usize / 2);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub fn get_thread_count() -> usize {
 | 
					pub fn get_thread_count() -> usize {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user