git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
JMJameson Miller <jameson.miller81@gmail.com>
Date
Sep 18, 2017, 17:24 UTC
Message-ID
<1505755473-6720-1-git-send-email-jamill@microsoft.com>
In-Reply-To
<20170810184936.239542-1-jamill@microsoft.com>

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
Previous: Jameson MillerNext: Jameson Miller
Message 8 of 11 in “Teach status to show ignored directories”
  1. 0/1 Teach status to show ignored directoriesJameson Miller, Aug 10, 2017
  2. 1/1 dir: teach status to show ignored directoriesJameson Miller, Aug 10, 2017
  3. Stefan BellerAug 10, 2017
  4. Jameson MillerAug 11, 2017
  5. Stefan BellerAug 14, 2017
  6. Brandon WilliamsAug 11, 2017
  7. Jameson MillerAug 11, 2017
  8. Improve performance of git status --ignoredJameson Miller, Sep 18, 2017
  9. Improve performance of git status --ignoredJameson Miller, Sep 18, 2017
  10. Junio C HamanoSep 19, 2017
  11. Brandon WilliamsSep 19, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.