mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-04 21:52:54 +02:00
ignore: improve multithreading heuristic
This copies the one found in ripgrep.
See also:
71d71d2d98/crates/core/flags/hiargs.rs (L172)
Closes #2854, Closes #2856
This commit is contained in:
committed by
Andrew Gallant
parent
a6275648b3
commit
d9744f3b03
@ -1305,7 +1305,7 @@ impl WalkParallel {
|
|||||||
|
|
||||||
fn threads(&self) -> usize {
|
fn threads(&self) -> usize {
|
||||||
if self.threads == 0 {
|
if self.threads == 0 {
|
||||||
2
|
std::thread::available_parallelism().map_or(1, |n| n.get()).min(12)
|
||||||
} else {
|
} else {
|
||||||
self.threads
|
self.threads
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user