diff --git a/Cargo.lock b/Cargo.lock index 333eb49..976e16d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -279,6 +279,7 @@ dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.toml b/Cargo.toml index 608e7f2..9d9d6eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ clap = "2.31" image = "0.22" num_cpus = "1.8" regex = "1.3" +rayon = "1.3.0" [profile.release] lto = true diff --git a/src/image_manager.rs b/src/image_manager.rs index 464438c..dafe33a 100644 --- a/src/image_manager.rs +++ b/src/image_manager.rs @@ -1,6 +1,7 @@ use std::path::Path; use std::thread::sleep; use std::time::Duration; +use rayon::prelude::*; use image; use image::{DynamicImage, FilterType}; @@ -32,7 +33,7 @@ impl ImageManager { // Load the images from the paths let image_manager = - ImageManager::from(paths.iter().map(|path| load_image(path, size)).collect()); + ImageManager::from(paths.par_iter().map(|path| load_image(path, size)).collect()); // TODO: process the image slices diff --git a/src/main.rs b/src/main.rs index 535819a..dad0b7e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ extern crate clap; extern crate image; +extern crate rayon; mod app; mod arg_handler;