{"thread":{"id":"31957","subject":"'git describe' is very slow on development trees with lots of commits","startedAt":"2012-10-27T13:33:52Z","lastAt":"2012-10-31T17:52:26Z","messageCount":2,"participants":["Ingo Molnar","Pavel Machek"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"202009","messageId":"20121027133352.GB30001@gmail.com","threadId":"31957","inReplyTo":"508AA709.7010202@gmail.com","subject":"'git describe' is very slow on development trees with lots of commits","fromName":"Ingo Molnar","fromEmail":"mingo@kernel.org","sentAt":"2012-10-27T13:33:52Z","receivedAt":"2012-10-27T13:33:52Z","isPatch":false,"sender":{"key":"mingo@kernel.org","avatar":null},"body":"\n(Cc:-ed the Git development list.)\n\n* David Ahern <dsahern@gmail.com> wrote:\n\n> PERF-VERSION-GEN and specifically the git commands are the \n> cause of more delay than the config checks, especially when \n> doing the build in a VM with the kernel source on an NFS \n> mount.\n\nYes, I have noticed that too.\n\nSo, the problem is that we use 'git describe' on the kernel tree \nto generate the version string, which is very, very slow if we \nare far away from any tagged release - which is the case for the \n-tip tree:\n\n comet:~/tip> perf stat --null --repeat 3 git describe\n v3.7-rc2-2007-g83e8223\n v3.7-rc2-2007-g83e8223\n v3.7-rc2-2007-g83e8223\n\n'git describe' is much faster if we are on or near to a tag:\n\n $ git checkout v3.6\n $ perf stat --null --repeat 3 git describe\n v3.6\n v3.6\n v3.6\n\n Performance counter stats for 'git describe' (3 runs):\n\n       0.020171640 seconds time elapsed                                          ( +-  3.64% )\n\n $ git checkout b34e5f55a1e6\n\n $ perf stat --null --repeat 3 git describe\n v3.6-41-gb34e5f5\n v3.6-41-gb34e5f5\n v3.6-41-gb34e5f5\n\n Performance counter stats for 'git describe' (3 runs):\n\n       0.155603676 seconds time elapsed                                          ( +-  0.23% )\n\nThe cost on this pretty fast machine is about 1 msecs per commit \n- which adds up to about 2.5 seconds during much of the \ndevelopment cycle.\n\nSo maybe we should be using a different version string, for \nexample, instead of:\n\n v3.7-rc2-2007-g83e8223\n\nthis would be perfectly fine:\n\n v3.7-rc2-g83e8223\n\nthe 'commit count' is informative but not essential - and in \ncounting the number of off-tag commits is where much of the \noverhead is:\n\n#\n# Overhead  Command       Shared Object                                      Symbol\n# ........  .......  ..................  ..........................................\n#\n    39.79%      git  libz.so.1.2.5       [.] 0x000000000000c1fe                    \n    26.39%      git  libz.so.1.2.5       [.] inflate                               \n    22.42%      git  git                 [.] 0x000000000009bd1e                    \n     2.99%      git  libz.so.1.2.5       [.] adler32                               \n     1.23%      git  libc-2.15.so        [.] _int_malloc                           \n     0.72%      git  libc-2.15.so        [.] __GI_____strtoull_l_internal          \n     0.67%      git  libc-2.15.so        [.] _int_free                             \n     0.62%      git  libc-2.15.so        [.] malloc_consolidate                    \n     0.54%      git  [kernel.kallsyms]   [k] clear_page_c                          \n     0.32%      git  [kernel.kallsyms]   [k] page_fault                            \n\nSo by switching to the shorter version string that still embedds \nthe tag and the exact sha1 we'd be able to run this script a \n*lot* faster.\n\nThanks,\n\n\tIngo\n"},{"id":"202335","messageId":"20121031175226.GB20660@elf.ucw.cz","threadId":"31957","inReplyTo":"20121027133352.GB30001@gmail.com","subject":"Re: 'git describe' is very slow on development trees with lots of commits","fromName":"Pavel Machek","fromEmail":"pavel@ucw.cz","sentAt":"2012-10-31T17:52:26Z","receivedAt":"2012-10-31T17:52:26Z","isPatch":false,"sender":{"key":"pavel@ucw.cz","avatar":null},"body":"Hi!\n\n> (Cc:-ed the Git development list.)\n> \n> * David Ahern <dsahern@gmail.com> wrote:\n> \n> > PERF-VERSION-GEN and specifically the git commands are the \n> > cause of more delay than the config checks, especially when \n> > doing the build in a VM with the kernel source on an NFS \n> > mount.\n> \n> Yes, I have noticed that too.\n....\n> The cost on this pretty fast machine is about 1 msecs per commit \n> - which adds up to about 2.5 seconds during much of the \n> development cycle.\n\nWell... I noticed my builds when little changed are very slow... and\nit was due to the computation of version string. Ouch.\n\npavel@amd:~/mainline-altera/linux$ time git describe\nfixes-for-linus-506-g71ca8691\n0.68user 0.22system 27.82 (0m27.820s) elapsed 3.26%CPU\npavel@amd:~/mainline-altera/linux$ \n\n(Cached it is more reasonable 3 seconds, but it keeps going out of\ncache all the time. Uncached clean build is 3 minutes, cached is 9\nseconds + time to do git describe).\n\nThikpad X60.\n\n\t\t\t\t\t\t\t\t\tPavel\n-- \n(english) http://www.livejournal.com/~pavelmachek\n(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html\n"}]}