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

Re: [PATCH v3] ls-files: filter pathspec before lstat

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 15, 2026, 15:27 UTC
Message-ID
<xmqq4ij3ddst.fsf@gitster.g>
In-Reply-To
<20260611-ls-files-pathspec-lstat-v3-1-f967e1a00c13@gmail.com>
Tamir Duberstein <tamird@gmail.com> writes:
Show 5 quoted lines
> Prefilter only a single pathspec item, bounding the added work for each
> index entry. Applying match_pathspec() to multiple arguments can cost
> more than the lstat() calls it avoids. In a synthetic repository with
> 10,000 clean files, passing every path to ls-files --modified increased
> runtime from 112.5 ms to 494.1 ms when the prefilter was unconditional.

I still think the choice of special casing a pathspec with a single element is a lot harder to justify and invite people to start complaining "why one and not three?" than not special casing any (which makes the code simpler as well), as long as it is documented clearly, like the above paragraph, why the performance characteristics are so much different when pathspec has more than one elments, the users and future developers can take it from there.

So let me mark the topic for 'next' now.
Thanks.
Previous: Tamir Duberstein
Message 12 of 12 in “ls-files: filter pathspec before lstat”
  1. ls-files: filter pathspec before lstatTamir Duberstein, Jun 9, 2026
  2. Junio C HamanoJun 9, 2026
  3. Tamir DubersteinJun 9, 2026
  4. Junio C HamanoJun 9, 2026
  5. Tamir DubersteinJun 9, 2026
  6. Jeff KingJun 9, 2026
  7. Tamir DubersteinJun 9, 2026
  8. Jeff KingJun 11, 2026
  9. Tamir DubersteinJun 11, 2026
  10. Junio C HamanoJun 11, 2026
  11. ls-files: filter pathspec before lstatTamir Duberstein, Jun 12, 2026
  12. Junio C HamanoJun 15, 2026

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.