summaryrefslogtreecommitdiffstats
path: root/src/common.rs
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2022-12-15 14:11:51 +0100
committerSebastian Thiel <sebastian.thiel@icloud.com>2022-12-15 15:03:06 +0100
commit78029853ba687cabd37adbbdf41b2ee480bbcbf8 (patch)
treeb6d4f7d4ea2563b9d030931d33c360595ddd2d2b /src/common.rs
parent9bdf26a7dbb7577ea10e0eac970c081a7bfa66a6 (diff)
create our own threadpool with minimal stack instead of using the global one.
Even though the global one is also ours as we own the process, this way we have control over the stack size, to save memory where we don't need it and scale better to even more cores.
Diffstat (limited to 'src/common.rs')
-rw-r--r--src/common.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/common.rs b/src/common.rs
index 45e9738..f5f862e 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -160,7 +160,16 @@ impl WalkOptions {
busy_timeout: std::time::Duration::from_secs(1),
},
1 => jwalk::Parallelism::Serial,
- _ => jwalk::Parallelism::RayonNewPool(self.threads),
+ _ => jwalk::Parallelism::RayonExistingPool {
+ pool: jwalk::rayon::ThreadPoolBuilder::new()
+ .stack_size(128 * 1024)
+ .num_threads(self.threads)
+ .thread_name(|idx| format!("dua-fs-walk-{idx}"))
+ .build()
+ .expect("fields we set cannot fail")
+ .into(),
+ busy_timeout: None,
+ },
})
}
}