checkout.c: enable fscache for checkout again

This is retry of #1419.

I added flush_fscache macro to flush cached stats after disk writing
with tests for regression reported in #1438 and #1442.

git checkout checks each file path in sorted order, so cache flushing does not
make performance worse unless we have large number of modified files in
a directory containing many files.

Using chromium repository, I tested `git checkout .` performance when I
delete 10 files in different directories.
With this patch:
TotalSeconds: 4.307272
TotalSeconds: 4.4863595
TotalSeconds: 4.2975562
Avg: 4.36372923333333

Without this patch:
TotalSeconds: 20.9705431
TotalSeconds: 22.4867685
TotalSeconds: 18.8968292
Avg: 20.7847136

I confirmed this patch passed all tests in t/ with core_fscache=1.

Signed-off-by: Takuto Ikuta <tikuta@chromium.org>
This commit is contained in:
Takuto Ikuta
2018-01-30 22:42:58 +09:00
committed by Git for Windows Build Agent
parent 74e068a28f
commit 0b16d8d5bf
7 changed files with 61 additions and 0 deletions

View File

@@ -1082,6 +1082,10 @@ static inline int is_missing_file_error(int errno_)
#define is_fscache_enabled(path) (0)
#endif
#ifndef flush_fscache
#define flush_fscache() /* noop */
#endif
int cmd_main(int, const char **);
/*