Skip to content

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

Open
@juliusl

Description

@juliusl
Contributor

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

Activity

added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Sep 9, 2024
added
O-windowsOperating system: Windows
I-slowIssue: Problems and improvements with respect to performance of generated code.
T-libsRelevant to the library team, which will review and decide on the PR/issue.
C-discussionCategory: Discussion or questions that doesn't represent real issues.
C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing such
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
C-discussionCategory: Discussion or questions that doesn't represent real issues.
on Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-filesystemArea: `std::fs`C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchI-slowIssue: Problems and improvements with respect to performance of generated code.O-windowsOperating system: WindowsT-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @juliusl@lolbinarycat@rustbot

        Issue actions

          Using `GetFileInformationByName` in Windows for file stat/metadata operations · Issue #130169 · rust-lang/rust