summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index a4501cf..109a6b3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -3,6 +3,7 @@ extern crate crypto_hash;
extern crate serde_yaml;
extern crate walkdir;
extern crate rayon;
+extern crate num_cpus;
use std::env;
use std::io;
@@ -17,7 +18,7 @@ type Map = BTreeMap<&'static str, String>;
fn main() -> io::Result<()> {
- let nproc = 4;
+ let nproc = num_cpus::get();
for dirname in env::args().skip(1) {
summain(&dirname, nproc);
}
@@ -35,6 +36,7 @@ fn summain(dirname: &str, nproc: usize) {
chunk.push(entry);
if chunk.len() == nproc {
process_chunk(&chunk);
+ chunk.clear();
}
}