Git development
 help / color / mirror / Atom feed
* [PATCH 0/2] ls-files: reuse the untracked cache
@ 2026-09-23 17:10 Tamir Duberstein
  2026-09-23 17:10 ` [PATCH 1/2] dir: hash ignore files before adding parser LF Tamir Duberstein
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Tamir Duberstein @ 2026-09-23 17:10 UTC (permalink / raw)
  To: git; +Cc: Tao Klerks, Junio C Hamano, Elijah Newren, Jeff King,
	Tamir Duberstein

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-09-23 22:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-23 17:10 [PATCH 0/2] ls-files: reuse the untracked cache Tamir Duberstein
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox