diff options
| author | Mason Reed <mason@vector35.com> | 2024-11-06 10:58:03 -0500 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2024-11-07 16:23:37 -0500 |
| commit | 6374e3fecfda083cdb7c2b454e5ed58cd631cc20 (patch) | |
| tree | a1140366756d975948f0e497a4083feaab673168 | |
| parent | e95e1bea09ba34f64b1243fa370a7774dbc9caa3 (diff) | |
WARP: Parallelize sigem `data_from_directory`
| -rw-r--r-- | plugins/warp/src/bin/sigem.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/warp/src/bin/sigem.rs b/plugins/warp/src/bin/sigem.rs index f752487d..9d158cf3 100644 --- a/plugins/warp/src/bin/sigem.rs +++ b/plugins/warp/src/bin/sigem.rs @@ -130,18 +130,26 @@ fn data_from_archive<R: Read>(mut archive: Archive<R>) -> Option<Data> { } fn data_from_directory(dir: PathBuf) -> Option<Data> { - let unmerged_data = WalkDir::new(dir) + let files = WalkDir::new(dir) .into_iter() .filter_map(|e| { let path = e.ok()?.into_path(); if path.is_file() { - log::info!("Creating data for FILE {:?}...", path); - data_from_file(&path) + Some(path) } else { None } }) .collect::<Vec<_>>(); + + let unmerged_data = files + .into_par_iter() + .filter_map(|path| { + log::debug!("Creating data for FILE {:?}...", path); + data_from_file(&path) + }) + .collect::<Vec<_>>(); + if !unmerged_data.is_empty() { Some(Data::merge(&unmerged_data)) } else { |
