From: Tamir Duberstein <tamird@gmail.com>
To: git@vger.kernel.org
Cc: Tao Klerks <tao@klerks.biz>, Junio C Hamano <gitster@pobox.com>,
Elijah Newren <newren@gmail.com>, Jeff King <peff@peff.net>,
Tamir Duberstein <tamird@gmail.com>
Subject: [PATCH 0/2] ls-files: reuse the untracked cache
Date: Wed, 23 Sep 2026 13:10:07 -0400 [thread overview]
Message-ID: <20260923-ls-files-untracked-cache-v1-0-08db4cc1efdb@gmail.com> (raw)
Repeated queries such as
git ls-files --cached --others --exclude-standard -z -- "**/pyproject.toml"
walk the working tree even when status has already populated an untracked
cache. This series lets ls-files reuse those directory listings. It
expands partial scans and collapsed untracked directories as needed,
without writing the converted cache back to the index.
The first patch fixes inconsistent ignore-file hashes that invalidate an
unchanged cache. The second enables reuse for ls-files and filters complete
listings after the walk. Fixed-prefix queries retain directory pruning;
attribute and exclude pathspecs retain their existing traversal because
matching a directory can differ from matching its children.
On macOS, a synthetic tree with 100,000 tracked files in 5,000 directories
and a few untracked files averaged 361 ms before and 50 ms after in five
hyperfine runs after one warmup. Directory opens fell from 5,058 to seven.
With half the files untracked, five alternating runs averaged 659 ms
before and 339 ms after; that case still expands 2,533 partially cached
directories. A cache populated with status.showUntrackedFiles=all avoids
directory opens in both cases. These measurements disable fsmonitor and
use a populated cache with a warm filesystem.
Uncached controls were noisy; the apparent slowdown in the first batch
did not recur. Literal-query results varied in both directions, with a
separate five-run hyperfine check measuring 17 ms before and 20 ms after.
Prepared with Codex, including code review and benchmark work by separate
Codex agents.
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
Tamir Duberstein (2):
dir: hash ignore files before adding parser LF
ls-files: reuse cached untracked listings
builtin/ls-files.c | 11 +++++--
dir.c | 64 +++++++++++++++++++++++++++++++++---
dir.h | 2 ++
t/perf/p3010-ls-files.sh | 15 +++++++++
t/t7063-status-untracked-cache.sh | 68 ++++++++++++++++++++++++++++++++++++---
5 files changed, 149 insertions(+), 11 deletions(-)
---
base-commit: 3bc0341126508f78f5869cbfc0005e987efdf0c7
change-id: 20260923-ls-files-untracked-cache-3559bed01a3e
next reply other threads:[~2026-09-23 17:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 17:10 Tamir Duberstein [this message]
2026-09-23 17:10 ` [PATCH 1/2] dir: hash ignore files before adding parser LF Tamir Duberstein
2026-09-23 17:10 ` [PATCH 2/2] ls-files: reuse cached untracked listings Tamir Duberstein
2026-09-23 18:38 ` [PATCH 0/2] ls-files: reuse the untracked cache Tamir Duberstein
2026-09-23 22:26 ` [PATCH v2 0/3] ls-files: reuse and update " Tamir Duberstein
2026-09-23 22:26 ` [PATCH v2 1/3] dir: hash ignore files before appending newline Tamir Duberstein
2026-09-23 22:26 ` [PATCH v2 2/3] dir: share untracked caches across output modes Tamir Duberstein
2026-09-23 22:27 ` [PATCH v2 3/3] ls-files: use and update the untracked cache Tamir Duberstein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260923-ls-files-untracked-cache-v1-0-08db4cc1efdb@gmail.com \
--to=tamird@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=newren@gmail.com \
--cc=peff@peff.net \
--cc=tao@klerks.biz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox