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

Using GetFileInformationByName in Windows for file stat/metadata operations #130169

Open
juliusl opened this issue Sep 9, 2024 · 0 comments
Open
Labels
A-filesystem Area: `std::fs` C-optimization Category: An issue highlighting optimization opportunities or PRs implementing such I-slow Issue: Problems and improvements with respect to performance of generated code. O-windows Operating system: Windows T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@juliusl
Copy link
Contributor

juliusl commented Sep 9, 2024

Continuing discussion from #128256...

Currently, window's fs.rs uses the GetFileInformationByHandle api which requires opening and closing a file handle. A new API will be available in future builds of Windows (from documentation it should be around 24H2/26052) called GetFileInformationByName which does not require opening a file handle. This reduces 2-3 syscalls in this code path which can have a reasonable performance gain.

There are a few design considerations however,

  • Not all file-system drivers support this API, for example FAT32
  • Backwards compatibility stops at 1709, i.e. (basically this feature would be #[cfg(not(target_vendor = "win7")] )

Currently, this change would support tier-1 support for #121478 since it includes all the fields needed in one call. In addition to removing the additional syscall for handling reparse points.

Prior Art:

Links:

cc: @ChrisDenton

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 9, 2024
@lolbinarycat lolbinarycat added O-windows Operating system: Windows I-slow Issue: Problems and improvements with respect to performance of generated code. T-libs Relevant to the library team, which will review and decide on the PR/issue. A-filesystem Area: `std::fs` C-discussion Category: Discussion or questions that doesn't represent real issues. C-optimization Category: An issue highlighting optimization opportunities or PRs implementing such and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. C-discussion Category: Discussion or questions that doesn't represent real issues. labels Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-filesystem Area: `std::fs` C-optimization Category: An issue highlighting optimization opportunities or PRs implementing such I-slow Issue: Problems and improvements with respect to performance of generated code. O-windows Operating system: Windows T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants