<filesystem>: Improve symlink_status performance by nikola-sh · Pull Request #5071 · microsoft/STL (original) (raw)

_Get_any_status(__Path, __std_fs_stats_flags::_Attributes | __std_fs_stats_flags::_Reparse_tag) calls to many WinAPI functions for regular files or directories. It calls GetFileAttributesEx + CreateFile + GetFileInformationByHandleEx(FileBasicInfo) but GetFileAttributesEx is enough to get all needed data if it is known that a file is not a reparse point.
This problem affects symlink_status performance.

Benchmark symlink_status results before changes:

---------------------------------------------------------
Benchmark               Time             CPU   Iterations
---------------------------------------------------------
symlink_status      15376 ns        15346 ns        44800

Benchmark symlink_status results after changes:

---------------------------------------------------------
Benchmark               Time             CPU   Iterations
---------------------------------------------------------
symlink_status       2219 ns         2148 ns       320000