diff options
author | J Wyman <jeremy.wyman@microsoft.com> | 2015-03-26 18:10:24 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2015-04-28 14:25:02 -0400 |
commit | 1920ee4ef6096f888a9bb19bc329424d2c7ee656 (patch) | |
tree | c3c3c5f7c734440389d12da5a64158ed6e52e6e8 /src/iterator.c | |
parent | 4c09e19a3764a1e5f3340dabf8104dfed32e7673 (diff) | |
download | libgit2-1920ee4ef6096f888a9bb19bc329424d2c7ee656.tar.gz |
Improvements to status performance on Windows.
Changed win32/path_w32.c to utilize NTFS' FindFirst..FindNext data instead of doing an lstat per file. Avoiding unnecessary directory opens and file scans reduces IO, improving overall performance. Effect is magnified due to NTFS being a kernel mode file system (as opposed to user mode).
Diffstat (limited to 'src/iterator.c')
-rw-r--r-- | src/iterator.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/iterator.c b/src/iterator.c index 8bab1aab0..80b7d5faa 100644 --- a/src/iterator.c +++ b/src/iterator.c @@ -984,6 +984,21 @@ static void fs_iterator__seek_frame_start( ff->index = 0; } +GIT_INLINE(int) path_dirload_with_stat( + const char *path, + size_t prefix_len, + unsigned int flags, + const char *start_stat, + const char *end_stat, + git_vector *contents) +{ +#if defined(GIT_WIN32) && !defined(__MINGW32__) + return git_win32_path_dirload_with_stat(path, prefix_len, flags, start_stat, end_stat, contents); +#else + return git_path_dirload_with_stat(path, prefix_len, flags, start_stat, end_stat, contents); +#endif +} + static int fs_iterator__expand_dir(fs_iterator *fi) { int error; @@ -998,7 +1013,7 @@ static int fs_iterator__expand_dir(fs_iterator *fi) ff = fs_iterator__alloc_frame(fi); GITERR_CHECK_ALLOC(ff); - error = git_path_dirload_with_stat( + error = path_dirload_with_stat( fi->path.ptr, fi->root_len, fi->dirload_flags, fi->base.start, fi->base.end, &ff->entries); @@ -1350,6 +1365,7 @@ GIT_INLINE(git_dir_flag) git_entry__dir_flag(git_index_entry *entry) { ? S_ISDIR(entry->mode) ? GIT_DIR_FLAG_TRUE : GIT_DIR_FLAG_FALSE : GIT_DIR_FLAG_UNKNOWN; #else + GIT_UNUSED(entry); return GIT_DIR_FLAG_UNKNOWN; #endif } |