tiny brained

This commit is contained in:
Lynne Megido 2021-02-18 19:15:59 +10:00
parent 40292fe334
commit 31acd76c73
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90

View file

@ -20,10 +20,10 @@ use std::path::{Path, PathBuf};
use clap::Clap;
use log::{debug, info, trace, warn};
use once_cell::sync::OnceCell;
use smartstring::alias::String;
use walkdir::{DirEntry, WalkDir};
#[cfg(feature = "multi-threaded")]
use rayon::prelude::*;
use smartstring::alias::String;
use walkdir::{DirEntry, WalkDir};
use crate::findings::Findings;
use crate::formats::{Format, Script};
@ -130,7 +130,7 @@ fn scan_file(entry: &DirEntry) -> Result<Findings, (ScanError, PathBuf)> {
fn scan_from_walkdir(entries: Vec<DirEntry>) -> Vec<Result<Findings, (ScanError, PathBuf)>> {
#[cfg(feature = "multi-threaded")] {
// rather than using a standard par_iter, split the entries into chunks of 32 first.
// this allows each spawned thread to handle 16 files before before closing, rather than creating a new thread for
// this allows each spawned thread to handle 32 files before before closing, rather than creating a new thread for
// each file. this leads to a pretty substantial speedup that i'm pretty substantially happy about 0u0
entries
.par_chunks(32) // split into chunks of 32
@ -197,7 +197,7 @@ fn main() {
let s = Script::new();
s.write_all(&results, &mut BufWriter::new(stdout().lock())).expect("failed to output");
}
OutputFormat::Text => debug!("eewr")
OutputFormat::Text => todo!()
}
debug!("Done");