Re: git checkout running very slowly (>12s)
- From
- Andrew Cameron <andrew@worksmartlabs.com>
- Date
- Jun 20, 2011, 20:26 UTC
- Message-ID
- <loom.20110620T221426-685@post.gmane.org>
- In-Reply-To
- <loom.20110616T010709-333@post.gmane.org>
Andrew Cameron <andrew <at> worksmartlabs.com> writes:
> > $ git --version > git version 1.7.0.4 >
In the interest of leaving a message of hope in the archives for users experiencing this same problem, I will record to the list that I managed to solve the problem, if not understand it. As you can see in the transcript above, I had been using an older version of git:
> $ git --version > git version 1.7.0.4
After running sudo apt-get build-dep git-core and then building git from source, we see this instead:
> $ git --version > git version 1.7.5.4
And the success story:
$ time git checkout master Switched to branch 'master' git checkout master 0.88s user 0.25s system 99% cpu 1.135 total $ time git checkout - Switched to branch 'newbranch' git checkout - 0.87s user 0.25s system 99% cpu 1.121 total
It might be interesting to note that both before and after upgrading git, running "strace -c git checkout master" in an attempt to figure out where all my time was spent was *not* particularly helpful. An excerpt from strace's output from before the upgrade:
% time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 100.00 0.003499 0 90884 7 lstat64
And another one from afterwards:
% time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 99.24 0.003276 0 90886 7 lstat64
In other words, it appears that an efficient lstat implementation was not the key factor in this problem. The root cause remains a mystery, but in my case, the solution was to upgrade Git.
Thanks for reading.