mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-11-04 09:01:56 +00:00 
			
		
		
		
	Only start offload worker thread when there's more than 1 core
This commit is contained in:
		@@ -2,6 +2,7 @@ use std::collections::HashSet;
 | 
				
			|||||||
use std::env;
 | 
					use std::env;
 | 
				
			||||||
use std::io::IsTerminal;
 | 
					use std::io::IsTerminal;
 | 
				
			||||||
use std::path::{Path, PathBuf};
 | 
					use std::path::{Path, PathBuf};
 | 
				
			||||||
 | 
					use std::thread::available_parallelism;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use crate::{
 | 
					use crate::{
 | 
				
			||||||
    clap_app,
 | 
					    clap_app,
 | 
				
			||||||
@@ -125,7 +126,9 @@ impl App {
 | 
				
			|||||||
        // start building glob matchers for builtin mappings immediately
 | 
					        // start building glob matchers for builtin mappings immediately
 | 
				
			||||||
        // this is an appropriate approach because it's statistically likely that
 | 
					        // this is an appropriate approach because it's statistically likely that
 | 
				
			||||||
        // all the custom mappings need to be checked
 | 
					        // all the custom mappings need to be checked
 | 
				
			||||||
        syntax_mapping.start_offload_build_all();
 | 
					        if available_parallelism()?.get() > 1 {
 | 
				
			||||||
 | 
					            syntax_mapping.start_offload_build_all();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if let Some(values) = self.matches.get_many::<String>("ignored-suffix") {
 | 
					        if let Some(values) = self.matches.get_many::<String>("ignored-suffix") {
 | 
				
			||||||
            for suffix in values {
 | 
					            for suffix in values {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user