[PATCH 0/4] optimizing upload-pack ref peeling
- From
Jeff King <peff@peff.net>
- Date
- Oct 4, 2012, 07:56 UTC
- Message-ID
- <20121004075609.GA1355@sigill.intra.peff.net>
- In-Reply-To
- <CACBZZX5Sm++Wjyoue-qk7TjwxUM3QihXfWGtEHhOq=VtkgvNbQ@mail.gmail.com>
On Thu, Oct 04, 2012 at 01:54:47AM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 8 quoted lines
> > Hmm. It seems like we should not need to open the tags at all. The main > > reason is to produce the "peeled" advertisement just after it. But for a > > packed ref with a modern version of git that supports the "peeled" > > extension, we should already have that information. > > B.t.w. do you plan to submit this as a non-hack, I'd like to have it > in git.git, so if you're not going to I could pick it up and clean it > up a bit. But I think it would be better coming from you.
Here's a cleaned-up version. I realized that peel_ref actually is quite close to what we want; the key thing is that when you are calling it from a for_each_ref loop it will not only use peeled information from packed-refs (if available), but it will also short-circuit the ref lookup for non-packed refs. So it really does what we want.
I put some timings into the final patch. The results are very satisfying from a pure numbers standpoint. However, I'm not 100% sure this is all that useful a benchmark. The repos where you get a noticeable benefit are quite big, so I suspect the time to send the advertisements out over the wire will dominate. Still, a CPU second saved is a CPU second earned.
And the series actually ends up making the code cleaner and shares some of the optimizations I put into upload-pack with other users of peel_ref. So I think I'd be inclined to use it, even if the speedup doesn't help that much in practice. We'll see what others think.
[1/4]: peel_ref: use faster deref_tag_noverify [2/4]: peel_ref: do not return a null sha1 [3/4]: peel_ref: check object type before loading [4/4]: upload-pack: use peel_ref for ref advertisements
-Peff