Re: [PATCH v5 08/16] refs: stop re-verifying common prefixes for availability
On Wed, Mar 12, 2025 at 09:22:59PM +0800, shejialuo wrote:
Show 20 quoted lines
> On Thu, Mar 06, 2025 at 04:08:39PM +0100, Patrick Steinhardt wrote:
> > diff --git a/refs.c b/refs.c
> > index 5a9b0f2fa1e..eaf41421f50 100644
> > --- a/refs.c
> > +++ b/refs.c
> > @@ -2514,6 +2517,14 @@ int refs_verify_refnames_available(struct ref_store *refs,
> > if (skip && string_list_has_string(skip, dirname.buf))
> > continue;
> >
> > + /*
> > + * If we've already seen the directory we don't need to
> > + * process it again. Skip it to avoid checking checking
> > + * common prefixes like "refs/heads/" repeatedly.
> > + */
> > + if (!strset_add(&dirnames, dirname.buf))
> > + continue;
> > +
>
> Reading here, I think we should not sort the refnames for "reftable"
> backend. Anyway, really a nice job for optimizing the speed.
Agreed, it's unnecessary for this optimization.
Patrick