mirror of
https://github.com/git/git.git
synced 2026-01-29 11:59:21 +00:00
fixup! Win32: add a cache below mingw's lstat and dirent implementations
The fscache_clear() function used to be O(n^2). But we can easily make it O(n) instead. Update fscache_clear to be O(n) instead of O(n^2) by using inter_next instead of starting from the begining each time with iter_first. While at it, also disallow rehashing while removing the entries. This speeds up a simple `git commit -m foo` when fscache is enabled (because fscache_clear() is called implicitly by preload_index()). Signed-off-by: Ben Peart <Ben.Peart@microsoft.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
committed by
Johannes Schindelin
parent
51efe4db88
commit
bda7f0728a
@@ -257,10 +257,13 @@ static void fscache_clear(void)
|
||||
{
|
||||
struct hashmap_iter iter;
|
||||
struct fsentry *fse;
|
||||
while ((fse = hashmap_iter_first(&map, &iter))) {
|
||||
hashmap_disallow_rehash(&map, 1);
|
||||
hashmap_iter_init(&map, &iter);
|
||||
while ((fse = hashmap_iter_next(&iter))) {
|
||||
fscache_remove(fse);
|
||||
fsentry_release(fse);
|
||||
}
|
||||
hashmap_disallow_rehash(&map, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user