]> git.ipfire.org Git - thirdparty/git.git/commit - dir.c
Improve performance of git status --ignored
authorJameson Miller <jamill@microsoft.com>
Mon, 18 Sep 2017 17:24:33 +0000 (13:24 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 19 Sep 2017 03:28:06 +0000 (12:28 +0900)
commit5aaa7fd39aafb83fdb30a6af4685eda5fc1cd382
tree093a4c243296a9610567045b0663fdb4862a5007
parent94c9fd268d4287f6fbfef84793288479905a7e48
Improve performance of git status --ignored

Improve the performance of the directory listing logic when it wants to list
non-empty ignored directories. In order to show non-empty ignored directories,
the existing logic will recursively iterate through all contents of an ignored
directory. This change introduces the optimization to stop iterating through
the contents once it finds the first file. This can have a significant
improvement in 'git status --ignored' performance in repositories with a large
number of files in ignored directories.

For an example of the performance difference on an example repository with
196,000 files in 400 ignored directories:

| Command                    |  Time (s) |
| -------------------------- | --------- |
| git status                 |   1.2     |
| git status --ignored (old) |   3.9     |
| git status --ignored (new) |   1.4     |

Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
dir.c