Skip to content

perf: Speedup other file ops on Windows#5199

Merged
lgritz merged 1 commit into
AcademySoftwareFoundation:mainfrom
adskWangl:optimize-win-filesystem
May 15, 2026
Merged

perf: Speedup other file ops on Windows#5199
lgritz merged 1 commit into
AcademySoftwareFoundation:mainfrom
adskWangl:optimize-win-filesystem

Conversation

@adskWangl

Copy link
Copy Markdown
Contributor

Description

Similar to #4977, replace std::filesystem with Windows APIs for better performance.

Tests

No new test.

Checklist:

  • I have read the guidelines on contributions and code review procedures.
  • I have read the Policy on AI Coding Assistants
    and if I used AI coding assistants, I have an Assisted-by: TOOL / MODEL
    line in the pull request description above.
  • I have updated the documentation if my PR adds features or changes
    behavior.
  • I am sure that this PR's changes are tested in the testsuite.
  • I have run and passed the testsuite in CI before submitting the
    PR, by pushing the changes to my fork and seeing that the automated CI
    passed there. (Exceptions: If most tests pass and you can't figure out why
    the remaining ones fail, it's ok to submit the PR and ask for help. Or if
    any failures seem entirely unrelated to your change; sometimes things break
    on the GitHub runners.)
  • My code follows the prevailing code style of this project and I
    fixed any problems reported by the clang-format CI test.
  • If I added or modified a public C++ API call, I have also amended the
    corresponding Python bindings. If altering ImageBufAlgo functions, I also
    exposed the new functionality as oiiotool options.

Signed-off-by: Lumina Wang <lumina.wang@autodesk.com>
@lgritz

lgritz commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Can I ask a naive question? Is the implementation of these std::filesystem functions on Windows not equivalent to what you wrote? Why are they so slow in the std library as provided by MSVS?

@adskWangl

Copy link
Copy Markdown
Contributor Author

Can I ask a naive question? Is the implementation of these std::filesystem functions on Windows not equivalent to what you wrote? Why are they so slow in the std library as provided by MSVC?

Functionally these changes can achieve what we expect from is_directory/is_regular/file_size (e.g. see file_status::_Refresh), while MS STL's implementation does contain more processing. The slowdown shares the same reason as stated in #4977, all of them fall in _std_fs_get_stats through _Status.type(), which is slow if the argument is a netwok path.

@lgritz lgritz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lgritz

lgritz commented May 15, 2026

Copy link
Copy Markdown
Collaborator

The CI failure appears unrelated, I will merge as soon as the Windows job completes.

@lgritz lgritz merged commit 9968f8c into AcademySoftwareFoundation:main May 15, 2026
53 of 56 checks passed
@lgritz lgritz added windows Problems specific to MS Windows OS performance labels May 20, 2026
lgritz pushed a commit to lgritz/OpenImageIO that referenced this pull request May 30, 2026
…eFoundation#5199)

Similar to AcademySoftwareFoundation#4977,
replace `std::filesystem` with Windows APIs for better performance.

Signed-off-by: Lumina Wang <lumina.wang@autodesk.com>
lgritz pushed a commit to lgritz/OpenImageIO that referenced this pull request May 30, 2026
…eFoundation#5199)

Similar to AcademySoftwareFoundation#4977,
replace `std::filesystem` with Windows APIs for better performance.

Signed-off-by: Lumina Wang <lumina.wang@autodesk.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance windows Problems specific to MS Windows OS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants