Re: [PATCH 8/7] cat-file: sort and de-dup output of --batch-all-objects
- From
Jeff King <peff@peff.net>
- Date
- Jun 22, 2015, 23:46 UTC
- Message-ID
- <20150622234624.GA13709@peff.net>
- In-Reply-To
- <20150622220350.GB18677@hashpling.org>
On Mon, Jun 22, 2015 at 11:03:50PM +0100, Charles Bailey wrote:
Show 5 quoted lines
> > The patch below does the sort/de-dup. I'd probably just squash it into > > patch 7, though. > > Woah, 8 out of 7! Did you get a chance to measure the performance hit of > the sort? If not, I may test it out when I next get the chance.
No, that last patch was my "eh, one more thing before bed" patch. ;)
It's easy enough to time, though. Running:
git cat-file --batch-all-objects \
--batch-check='%(objectsize) %(objectname)' \
--buffer >/dev/nullon linux.git, my best-of-five goes from (no sorting):
real 0m3.604s user 0m3.556s sys 0m0.048s
to (with sorting):
real 0m4.053s user 0m4.004s sys 0m0.052s
So it does matter, but not too much. We could de-dup with a hash table, which might be a little faster, but I doubt it would make much difference. It's also mostly in sorted order already; it's possible that a merge sort would behave a little better. I'm not sure how deep it's worth going into that rabbit hole.
-Peff