Subject: Re: [PATCH v2 0/9] address packed-refs speed regressions

From: Jeff King <[email-masked]>
Date: Thu, 16 Apr 2015 05:25:19 -0400

On Thu, Apr 16, 2015 at 04:47:34AM -0400, Jeff King wrote:

> Here's a re-roll incorporating feedback from the list. Thanks everybody
> for your comments. Last time the final number was ~8.5s, which was
> disappointingly slower than v2.0.0. In this iteration, my final numbers
> are:
> 
>   real    0m5.703s
>   user    0m5.276s
>   sys     0m0.432s
> 
> which is quite pleasing.

I forgot to mention what I _didn't_ include.

We discussed using mmap instead of stdio. Applying René's mmap patch
drops my best-of-five here to 5.114s. Which is nice, but it is a bit
more invasive (and does not help other callers of strbuf_getline).

If I further apply my really nasty patch to avoid the strbuf entirely
(i.e., we parse straight out of the mmap), I can get it down to 4.835s.

I don't know if the complexity is worth it or not. Ultimately, I think
the best route to making packed-refs faster is to drop the whole
ref_cache structure and just iterate directly over the mmap data. It
would use less RAM, and it opens the possibility of binary-searching to
look at only a subset of the entries. That's a _lot_ more invasive,
though.

-Peff