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

Re: git diff timing oddity

From
Jeff King <peff@peff.net>
Date
May 6, 2010, 05:08 UTC
Message-ID
<20100506050836.GA11578@coredump.intra.peff.net>
In-Reply-To
<y2j76718491005052204qb6de9c26k58eb1550f1c5346f@mail.gmail.com>
On Thu, May 06, 2010 at 01:04:18AM -0400, Jay Soffian wrote:
Show 22 quoted lines
> git version 1.7.1, Mac OS X 10.6.3, largish repo (42K files, 35K
> commits, well packed ~ 1GB). Difference between origin and HEAD is a
> single commit.
> 
> $ time git diff --stat origin  >/dev/null
> 
> real	0m0.942s
> user	0m0.713s
> sys	0m0.223s
>
> [...]
>
> $ time git diff --stat origin HEAD >/dev/null
> 
> real	0m0.022s
> user	0m0.006s
> sys	0m0.012s
>
> [...]
> 
> These should be identical commands, so why is the "origin HEAD" form
> running an order of magnitude faster?
Isn't "git diff --stat origin" comparing against the working tree?
-Peff
Previous: Jay Soffian
Message 3 of 3 in “git diff timing oddity”
  1. Jay SoffianMay 6, 2010
  2. Jay SoffianMay 6, 2010
  3. Jeff KingMay 6, 2010

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.