Re: [BUG] "git describe --match" performance
- From
Jeff King <peff@peff.net>
- Date
- Oct 31, 2024, 11:47 UTC
- Message-ID
- <20241031114731.GA608553@coredump.intra.peff.net>
- In-Reply-To
- <20241030044322.b5n3ji2n6gaeo5u6@treble.attlocal.net>
On Tue, Oct 29, 2024 at 09:43:22PM -0700, Josh Poimboeuf wrote:
Show 18 quoted lines
> $ time git describe --match=v6.10-rc7 --debug > describe HEAD > No exact match on refs or tags, searching to describe > finished search at d8470b7c13e11c18cf14a7e3180f0b00e715e4f0 > annotated 1844 v6.10-rc7 > traversed 1282750 commits > v6.10-rc7-1844-gc61e41121036 > > real 0m9.243s > user 0m8.940s > sys 0m0.268s > > $ time git describe > v6.10-rc7-1844-gc61e41121036 > > real 0m0.149s > user 0m0.111s > sys 0m0.036s
There's more discussion of the actual solution in the nearby thread from Rasmus. But I did want to note one thing here: when I initially tried to reproduce your problem, my "slow" case was a lot less bad.
The reason is that I had a commit graph file to speed up traversal. So independent of the git-describe fix, you might want to try:
git commit-graph write --reachable
That reduces the slow case for me by a factor of 10. And likewise other traversal operations should get faster.
I think we'll build the commit graph file by default these days when you run "git gc". But we don't build it immediately after cloning. Perhaps we should change that.
-Peff