Subject: Re: [PATCH v5 2/2] refs.c: SSE4.2 optimizations for check_refname_component

From: David Turner <[email-masked]>
Date: Tue, 03 Jun 2014 23:35:11 -0400

On Tue, 2014-06-03 at 15:05 -0700, Junio C Hamano wrote:
> > +		if (((uintptr_t) vp & (PAGE_SIZE - 1)) > PAGE_SIZE - BLOCK_SIZE)
> > +			/* End-of-page; fall back to slow method for
> > +			 * this entire component. */
> > +			return check_refname_component_1(refname, flags);
> 
> It is somewhat sad that we have to redo the whole thing, but nobody
> higher in the callchain knows how long the refname will be before
> calling us, so this cannot be avoided.

It actually could be avoided; we could pass in some extra args that let
check_refname_component_1 start checking after the part that we have
already checked.  I decided not to do this because I believe that
the average refname component is short, which means that the cost is not
too high and that it won't happen very often.  But I would be willing to
change this if you would like.