make image preloading parallel
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -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)",
|
||||
]
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
extern crate clap;
|
||||
extern crate image;
|
||||
extern crate rayon;
|
||||
|
||||
mod app;
|
||||
mod arg_handler;
|
||||
|
||||
Reference in New Issue
Block a user