ignore
ignore copied to clipboard
Support ReadOnlySpan<char> for IsMatch()
Example:
public bool IsMatch(ReadOnlySpan<char> input)
{
return parsedRegex != null && parsedRegex.IsMatch(input);
}
Just add that signature in addition to the one taking string.
This reduces my time of scanning 200K files from 1.79 --> 1.57 seconds.
It's because the ReadOnlySpan supports an efficient Slice() operation, so I'm not scanning the part of the path above where the .gitignore file resides.
I'm the author of ViLark, a file chooser for vim, sort of like fzf.
And thanks for this library, it helps a lot. Although I am getting very slow performance with a wildcard like '*.pyc', I might dig into that if I have time.
Thanks for the suggestion. Feel free to raise a PR, otherwise I will try to get to this tomorrow.
Yeah always good to improve performance. The library uses a bunch of regex, which I tried to follow best practices for, but maybe there can be improvements there.