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.