You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there I try to get all repositories in my filesystem. Therefore I wrote a WalkDir:
WalkDir::new(root)
.into_iter()
.par_bridge() // Convert iterator to a parallel iterator
.filter_map(|entry| entry.ok())
.filter(|entry| entry.file_type().is_dir())
.filter(|entry| {
let path = entry.path();
// Check if the directory contains a .git folder
path.join(".git").is_dir()
})
.filter(|entry| {
let path_str = entry.path().to_string_lossy();
// Check if the path matches the regex pattern
regex.is_match(&path_str) ^ reverse
})
.map(|entry| entry.into_path())
.collect()
This works pretty good but it could be faster. My thoughts were, that I could skip_current_dir after the .git folder is found not allowing recursive git folders (which makes sense) but I'm not sure how to achieve that.
Can someone tell me how to do that and if there are other performance optimizations I could try?
The text was updated successfully, but these errors were encountered:
Hi there I try to get all repositories in my filesystem. Therefore I wrote a WalkDir:
This works pretty good but it could be faster. My thoughts were, that I could
skip_current_dir
after the .git folder is found not allowing recursive git folders (which makes sense) but I'm not sure how to achieve that.Can someone tell me how to do that and if there are other performance optimizations I could try?
The text was updated successfully, but these errors were encountered: