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

git diff timing oddity

From
Jay Soffian <jaysoffian@gmail.com>
Date
May 6, 2010, 05:04 UTC
Message-ID
<y2j76718491005052204qb6de9c26k58eb1550f1c5346f@mail.gmail.com>

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  >/dev/null

real 0m0.944s user 0m0.712s sys 0m0.227s

$ time git diff --stat origin  >/dev/null

real 0m0.944s user 0m0.712s sys 0m0.225s

$ time git diff --stat origin HEAD >/dev/null

real 0m0.022s user 0m0.006s sys 0m0.012s

$ time git diff --stat origin HEAD >/dev/null

real 0m0.022s user 0m0.006s sys 0m0.013s

$ time git diff --stat origin HEAD >/dev/null

real 0m0.023s user 0m0.006s sys 0m0.013s

These should be identical commands, so why is the "origin HEAD" form running an order of magnitude faster?

j.
Next: Jay Soffian
Message 1 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.