[BUG] "git describe --match" performance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
> 
> What did you do before the bug happened? (Steps to reproduce your issue)

$ git clone https://github.com/torvalds/linux
$ cd linux
$ git checkout c61e41121036

$ 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

> What did you expect to happen? (Expected behavior)

I expected "git describe --match=v6.10-rc7" to be faster than plain "git
describe".

> What happened instead? (Actual behavior)

It takes over 9 seconds and traverses 1282750 commits.

(In my actual Linux git repo it's even worse at 15 seconds due to more
git history.)

> What's different between what you expected and what actually happened?

Over 9 seconds :-)

> Anything else you want to add:

I see this with both version 2.47.0 and the next branch.

This command is used by the kernel setlocalversion script, which is run
for every kernel build, so it adds 10-15 seconds to every build on an
untagged commit.

I suspect the problem is that there's only a single match for
"v6.10-rc7", but it tries to find 10 candidates so it ends up searching
the entire history.  But "--candidates=1" doesn't seem to help unless I
add a second match like so:

$ time git describe --match=v6.10-rc7 --match=v6.10-rc6 --candidates=1
v6.10-rc7-1844-gc61e41121036

real	0m0.112s
user	0m0.081s
sys	0m0.031s

> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.

[System Info]
git version:
git version 2.47.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
libcurl: 8.6.0
OpenSSL: OpenSSL 3.2.2 4 Jun 2024
zlib: 1.3.1.zlib-ng
uname: Linux 6.10.12-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Sep 30 21:38:25 UTC 2024 x86_64
compiler info: gnuc: 14.2
libc info: glibc: 2.39
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]

-- 
Josh




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux