Some minor performance tweaks.

This includes moving basename-only globs into separate regexes. The hope
is that if the regex processes less input, it will be faster.
This commit is contained in:
Andrew Gallant
2016-09-16 16:13:28 -04:00
parent 1c5884b2f9
commit 0d14c74e63
5 changed files with 71 additions and 22 deletions

View File

@@ -19,6 +19,7 @@ use std::io;
use std::path::{Path, PathBuf};
use gitignore::{self, Gitignore, GitignoreBuilder, Match, Pattern};
use pathutil::is_hidden;
use types::Types;
const IGNORE_NAMES: &'static [&'static str] = &[
@@ -377,14 +378,6 @@ impl Overrides {
}
}
fn is_hidden<P: AsRef<Path>>(path: P) -> bool {
if let Some(name) = path.as_ref().file_name() {
name.to_str().map(|s| s.starts_with(".")).unwrap_or(false)
} else {
false
}
}
#[cfg(test)]
mod tests {
use std::path::Path;