Subject: [PATCH v2] Improve performance of git status --ignored

From: Jameson Miller <[email-masked]>
Date: Mon, 18 Sep 2017 13:24:32 -0400

This is the second version of my patches to improve handling of
ignored files

I have decided to break the original patch series into two parts:

 1) Perf improvements to handling ignored directories

 2) Expose extra options to control which ignored files are displayed
 by git status.

This patch will address #1, and I will follow up with another patch
for #2.

This patch improves the performance of 'git status --ignored' by
cutting out unnecessary work when determining if an ignored directory
is empty or not. The current logic will recursively enumerate through
all contents of an ignored directory to determine whether it is empty
or not. The new logic will return after the 1st file is
encountered. This can result in a significant speedup in work dirs
with a lot of files in ignored directories.

As an example of the performance improvement, here is a representative
example of a repository with ~190,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   |

Jameson Miller (1):
  Improve performance of git status --ignored

 dir.c | 47 +++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 41 insertions(+), 6 deletions(-)

-- 
2.7.4