[llvm-bugs] [Bug 47307] New: filesystem directory_iterator calls stat on every file
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Aug 25 13:40:24 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47307
Bug ID: 47307
Summary: filesystem directory_iterator calls stat on every file
Product: libc++
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: llvm at alex.lanin.de
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
On my machine directory_iterator executes stat on every single file. For others
it does not. My best guess is that the behavior is related to WSL2 as that's
the major difference I have to the other machine where tested.
Unfortunately I do not know how to investigate further. If anyone wants to look
at this and does not have WSL I could certainly provide more info if directed
how to do that.
Code:
for (auto& p : std::filesystem::recursive_directory_iterator(path)) {}
Measurement:
strace -e trace=%file -r ./run 2> syscalls.txt
Comparison vs:
https://github.com/ccache/ccache/blob/8b595b04ce6/src/Util.cpp#L1308
Note: _DIRENT_HAVE_D_TYPE is defined
Time measurement listing llvm files via google benchmark:
opendir ~105ms
std::filesystem::directory_iterator ~350ms
std::filesystem::recursive_directory_iterator ~350ms
Compiled via:
CC=gcc CXX=g++ cmake ../llvm/ -GNinja
-DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;libcxx;libcxxabi;compiler-rt'
-DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86"
-DLLVM_APPEND_VC_REV=Off -DLLVM_CCACHE_BUILD=On
Version:
51a82828fb291fc8f77 (23. Aug 2020)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200825/4aff5d9f/attachment.html>
More information about the llvm-bugs
mailing list