Subject: Re: [PATCH 2/2] log: do not shorten decoration names too early

From: Jeff King <[email-masked]>
Date: Thu, 14 May 2015 14:10:08 -0400

On Thu, May 14, 2015 at 11:01:03AM -0700, Junio C Hamano wrote:

> > So with your slab_peek() below, I'd guess that the slab would actually
> > be faster. But I'd also be unsurprised if it makes no appreciable
> > difference to the overall runtime of "git log --decorate". I think we'd
> > have to build it and profile (and please feel free to say "eh, not worth
> > the time to think about further").
> 
> While I think *slabname##_peek() would be worth doing regardless of
> this caller, I suspect that the major overhead of decorate code
> would come from the for_each_ref() that jumps deep into the history
> to parse old commits; it would trigger a lot of unpacking of objects
> deep in the delta chain, which would be expensive than table look-up
> in either scheme.

That would depend on the particular repository and traversal. The
expensive "load an old commit" work is done once per ref in the repo.
The lookup work is done once per commit traversed. So even if the latter
is much less work, we are typically doing it many more times, and there
is probably a balance point.

But I suspect all of it compares to the actual work of a "git log" which
has to read all of the commits we are looking at anyway. IOW, we are
probably talking about optimizing 1%, while the other 99% is spent on
inflate(), etc.

-Peff