Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please reduce unnecessary and repeated stat()s #94

Open
rafl opened this issue Jun 17, 2019 · 1 comment
Open

Please reduce unnecessary and repeated stat()s #94

rafl opened this issue Jun 17, 2019 · 1 comment

Comments

@rafl
Copy link

rafl commented Jun 17, 2019

In certain environments, tidyall is currently far slower than it needs to be, due to its use of (the bundled version of) File::Zglob.

Consider, for example, a configuration with ignore = **/node_modules/**/* in an environment where there's multiple large directories matching that pattern. In the current implementation, this will result in the file system being fully traversed to generate a list of ignored files. This can take a lot of time, and causes unnecessary I/O. Checking if a given file name is to be ignored can be achieved without any I/O at all.

This issue is made worse by this operation potentially happening many times for the same pattern, depending on configuration.

I'm not sure what solution to suggest. It might be nice to get rid of the unmaintained File::Zglob module you currently have to bundle, and the code of which looks pretty dire to me. Checking whether or not to ignore a path could be done pretty easily by compiling the pattern to a regex or similar. Maybe it's worth keeping File::Zglob for the actual globbing portion, but it doesn't seem too hard to replace for that either.

Alternatives that leave File::Zglob in place as is might be to provide a different way of ignoring entire directories (maybe with ignore=dir/), in such a way that no globbing to find ignores would be performed at all, or perhaps allowing non-zglob patterns such as regular expressions to be used in configuration directives.

@autarch
Copy link
Member

autarch commented Jul 28, 2019

Or ... you could test out my new replacement for tidyall, precious. I think it should be usable now but there's no docs yet. If you're interested I can help you create the config file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants