Skip to content

Commit 530e234

Browse files
benpeartdscho
authored andcommitted
fscache: use FindFirstFileExW to avoid retrieving the short name
Use FindFirstFileExW with FindExInfoBasic to avoid forcing NTFS to look up the short name. Also switch to a larger (64K vs 4K) buffer using FIND_FIRST_EX_LARGE_FETCH to minimize round trips to the kernel. In a repo with ~200K files, this drops warm cache status times from 3.19 seconds to 2.67 seconds for a 16% savings. Signed-off-by: Ben Peart <[email protected]>
1 parent 20001c8 commit 530e234

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compat/win32/fscache.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ static struct fsentry *fsentry_create_list(const struct fsentry *dir)
187187
pattern[wlen] = 0;
188188

189189
/* open find handle */
190-
h = FindFirstFileW(pattern, &fdata);
190+
h = FindFirstFileExW(pattern, FindExInfoBasic, &fdata, FindExSearchNameMatch,
191+
NULL, FIND_FIRST_EX_LARGE_FETCH);
191192
if (h == INVALID_HANDLE_VALUE) {
192193
err = GetLastError();
193194
errno = (err == ERROR_DIRECTORY) ? ENOTDIR : err_win_to_posix(err);

0 commit comments

Comments
 (0)