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/win32/path_w32.h | |
| 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/win32/path_w32.h')
| -rw-r--r-- | src/win32/path_w32.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/win32/path_w32.h b/src/win32/path_w32.h index 033afbb0f..57ce732d6 100644 --- a/src/win32/path_w32.h +++ b/src/win32/path_w32.h @@ -8,6 +8,7 @@ #define INCLUDE_git_path_w32_h__ #include "common.h" +#include "vector.h" /* * Provides a large enough buffer to support Windows paths: MAX_PATH is @@ -79,4 +80,30 @@ extern int git_win32_path_to_utf8(git_win32_utf8_path dest, const wchar_t *src); */ extern char *git_win32_path_8dot3_name(const char *path); +#if !defined(__MINGW32__) +/** + * Load all directory entries along with stat info into a vector. + * Performed in a single pass per directory for optimized performance on Windows. + * + * This adds four things on top of plain `git_path_dirload`: + * + * 1. Each entry in the vector is a `git_path_with_stat` struct that + * contains both the path and the stat info + * 2. The entries will be sorted alphabetically + * 3. Entries that are directories will be suffixed with a '/' + * 4. Optionally, you can be a start and end prefix and only elements + * after the start and before the end (inclusively) will be stat'ed. + * + * @param path The directory to read from + * @param prefix_len The trailing part of path to prefix to entry paths + * @param flags GIT_PATH_DIR flags from above + * @param start_stat As optimization, only stat values after this prefix + * @param end_stat As optimization, only stat values before this prefix + * @param contents Vector to fill with git_path_with_stat structures + */ +extern int git_win32_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); +#endif + +extern int git_win32_path_readlink_w(git_win32_path dest, const git_win32_path path); + #endif |
