Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add: use preload-index and fscache for performance
Teach "add" to use preload-index and fscache features
to improve performance on very large repositories.

During an "add", a call is made to run_diff_files()
which calls check_remove() for each index-entry.  This
calls lstat().  On Windows, the fscache code intercepts
the lstat() calls and builds a private cache using the
FindFirst/FindNext routines, which are much faster.

Somewhat independent of this, is the preload-index code
which distributes some of the start-up costs across
multiple threads.

Signed-off-by: Jeff Hostetler <[email protected]>
  • Loading branch information
jeffhostetler committed Nov 22, 2016
commit 38df35b50380685476ea1e251b4593f32ae650f0
7 changes: 4 additions & 3 deletions builtin/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)
return 0;
}

if (read_cache() < 0)
die(_("index file corrupt"));

/*
* Check the "pathspec '%s' did not match any files" block
* below before enabling new magic.
Expand All @@ -389,6 +386,10 @@ int cmd_add(int argc, const char **argv, const char *prefix)
PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE,
prefix, argv);

enable_fscache(1);
if (read_cache_preload(&pathspec) < 0)
die(_("index file corrupt"));

if (add_new_files) {
int baselen;

Expand Down