Add Rayon for parallel file checking
Some checks failed
Core Repos/Rack/pipeline/head There was a failure building this commit

Now we're almost entirely IO bound, rather than having to wait to
read and search through files one at a time.
This commit is contained in:
Cameron Cordes
2021-02-15 20:08:52 -05:00
parent 827aad57dc
commit 5bc72ec67d
3 changed files with 123 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ fn main() {
mod rack {
use ::rack::config::Config;
use ::rack::filematch::*;
use rayon::prelude::*;
use std::fs::{self, DirEntry, File};
use std::io;
use std::io::prelude::*;
@@ -121,7 +122,7 @@ mod rack {
let mut results = traversal
.entries
.iter()
.par_iter()
.filter_map(|e| self.check_file(&e.path).ok())
.filter(|mat| mat.matches.len() > 0)
.collect::<Vec<FileMatch>>();