Subject: Re: [PATCH v2 1/5] sparse-checkout: refactor skip worktree retry logic

From: Junio C Hamano <[email-masked]>
Date: Thu, 27 Jun 2024 22:50:52 -0700

Elijah Newren <[email-masked]> writes:

>> restarts from the beginning.  I wonder if it would help, especially
>> if the S_ISSPARSEDIR entry comes very late in the index (e.g., by
>
> "the S_ISSPARSEDIR entry"?  Are you assuming there is only one?

No, but I was referring to the first one we encounter in the first
attempt loop that causes us to run the ensure_full() thing.  If the
first SPARSEDIR comes very late, there are many index entries before
that one that are already dealt with in the first attempt loop, and
for these early entries that are already handled, the second attempt
loop will do nothing but just skip.

> expected.  However, if "restart from there" is just passing the
> name of the relevant directory and we do some kind of binary search to
> find where the earliest entry under that directory would exist in the
> expanded index, then that seems like a reasonable additional
> optimization.

Perhaps.  I do not think it is known if it is worth doing, and I do
think it is better to finish this current round and then explore
further optimization opportunities on top after the dust settles.

Thanks.