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

Excessive stat syscalls on linux #79

Closed
the8472 opened this issue Apr 19, 2019 · 2 comments · Fixed by #135
Closed

Excessive stat syscalls on linux #79

the8472 opened this issue Apr 19, 2019 · 2 comments · Fixed by #135

Comments

@the8472
Copy link
Member

the8472 commented Apr 19, 2019

The directory traversal performs a .metadata() on each entry to check whether it is a directory, which results in a syscall. This is extremely wasteful since DirEntry::file_type can grab the file type directly from the readdir results which are obtained in batches via getdents syscall, i.e. only 1 syscall every N directory entries.

An additional problem is that there are multiple metadata() calls. They are not cached on the file descriptor, so each call results in an additional syscall.

@NilsIrl
Copy link

NilsIrl commented Mar 21, 2021

Maybe this could also be fixed by improving the standard library? As it stands, I don't think there's anyway to access the results of readdir in rust (using the standard library). So I think this is more of a problem to do with the standard library.

@the8472
Copy link
Member Author

the8472 commented Mar 21, 2021

I don't think there's anyway to access the results of readdir in rust (using the standard library).

There is, I explicitly mentioned it in my initial comment

This is extremely wasteful since DirEntry::file_type can grab the file type directly from the readdir results

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

Successfully merging a pull request may close this issue.

2 participants