git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git checkout running very slowly (>12s)

From
ACAndrew 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.
Previous: Andrew CameronNext: Jeff King
Message 4 of 7 in “git checkout running very slowly (>12s)”
  1. Andrew CameronJun 15, 2011
  2. Andreas EricssonJun 15, 2011
  3. Andrew CameronJun 15, 2011
  4. Andrew CameronJun 20, 2011
  5. Jeff KingJun 21, 2011
  6. Jeff KingJun 21, 2011
  7. Andrew CameronJun 21, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.