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:
12
src/walk.rs
12
src/walk.rs
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user