Win32 API FindFirstFile and FindNextFile performance vs command line

后端 未结 3 1400
礼貌的吻别
礼貌的吻别 2021-01-12 10:16

We have encountered an unexpected performance issue when traversing directories looking for files using a wildcard pattern.

We have 180 folders each containing 10,00

相关标签:
3条回答
  • 2021-01-12 10:27

    Try IShellFolder::EnumObjects with SHGetDataFromIDList/IShellFolder::GetAttributesOf.

    Pro/Cons here.

    0 讨论(0)
  • 2021-01-12 10:29

    You can try with an implementation of FindFirstFile and FindNextFile I once blogged about.

    0 讨论(0)
  • 2021-01-12 10:36

    In my tests using FindFirstFileEx with FindExInfoBasic and FIND_FIRST_EX_LARGE_FETCH is much faster than the plain FindFirstFile.

    Scanning 20 folders with ~300,000 files took 661 seconds with FindFirstFile and 11 seconds with FindFirstFileEx. Subsequent calls to the same folders took less than a second.

    HANDLE h=FindFirstFileEx(search.c_str(), FindExInfoBasic, &data, FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH); 
    
    0 讨论(0)
提交回复
热议问题