Lots of improvements. Most notably, removal of memory maps for searching.

Memory maps appear to degrade quite a bit in the presence of multithreading.

Also, switch to lock free data structures for synchronization. Give each
worker an input and output buffer which require no synchronization.
This commit is contained in:
Andrew Gallant
2016-08-28 20:18:34 -04:00
parent 1c8379f55a
commit c809679cf2
5 changed files with 258 additions and 261 deletions

View File

@@ -4,6 +4,8 @@ crate that can efficiently skip and ignore files and directories specified in
a user's ignore patterns.
*/
use std::path::PathBuf;
use walkdir::{self, DirEntry, WalkDir, WalkDirIterator};
use ignore::Ignore;
@@ -39,9 +41,9 @@ impl Iter {
}
impl Iterator for Iter {
type Item = DirEntry;
type Item = PathBuf;
fn next(&mut self) -> Option<DirEntry> {
fn next(&mut self) -> Option<PathBuf> {
while let Some(ev) = self.it.next() {
match ev {
Err(err) => {
@@ -74,7 +76,11 @@ impl Iterator for Iter {
if !ent.file_type().is_file() {
continue;
}
return Some(ent);
let mut path = ent.path();
if let Ok(p) = path.strip_prefix("./") {
path = p;
}
return Some(path.to_path_buf());
}
}
}