summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-10-02 17:03:49 +0300
committerLars Wirzenius <liw@liw.fi>2018-10-02 17:03:49 +0300
commitf107d705b5ee2aa7e996903073e9632abf259501 (patch)
tree459b671d00b9e5b5c1d43f640332382055d9bf2a /src
parent848a3fd22b5a4b8ab32b18c87229b0956c4e0336 (diff)
downloadsummainrs-f107d705b5ee2aa7e996903073e9632abf259501.tar.gz
Change: use nproc threads, fix chunking
Diffstat (limited to 'src')
-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();
}
}