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
Poor globbing performance in nfs-mounted directory with lots of subdirectories. #9891
Comments
What does You want something like |
Sidenote:
Yeah, as a rule we don't do caching like that - in most cases the filesystem cache will do better than we do and cache eviction is terrible. I don't believe a cache is the correct answer here or most other places and don't want to add it. |
Okay, you're gonna love this one, we checked if a file existed that we already knew existed. Since we're now using the same number of syscalls as "ls", and it's all stat-ish (newfstatat vs statx), I'm gonna call this one done for now. Thanks for filing! |
Saw the same thing in strace! Thanks for the quick fix! |
This confirmed that a file existed via access(file, F_OK). But we already *know* that it does because this is the expansion for the "trailing slash" - by definition all wildcard components up to here have already been checked. And it's not checking for directoryness either because it does F_OK. This will remove one `access()` per result, which will cut the number of syscalls needed for a glob that ends in a "/" in half. This brings us on-par with e.g. `ls` (which uses statx while we use newfstatat, but that should have about the same results) Fixes #9891. (cherry picked from commit 6823f5e)
Running fish 3.6.1 on SLES 12 (with clean home dir). For additional context, please see IlanCosman/tide#420
I have an nfs-mounted directory with ~4000 subdirectories. If I do something like
set -l glob /path/a*/
, where/path/
has lots of subdirs starting witha
, it takes upwards of 2 min to complete. Doing anls /path
even at its worst, never takes more than ~10s. I'm not sure what the globbing is doing that is slowing it down.The globbing does not appear to cache the results between commands, even though the filesystem itself does. If I do
set -l glob /path/a*/; set l glob /path/ab*/
where the result is the same number of directories, the second glob runs instantly. When I run the same command a second time, though, it still takes 2 minutes, even though its immediately after.The text was updated successfully, but these errors were encountered: