{"thread":{"id":"23713","subject":"git diff timing oddity","startedAt":"2010-05-06T05:04:18Z","lastAt":"2010-05-06T05:08:36Z","messageCount":3,"participants":["Jay Soffian","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"141026","messageId":"y2j76718491005052204qb6de9c26k58eb1550f1c5346f@mail.gmail.com","threadId":"23713","inReplyTo":null,"subject":"git diff timing oddity","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-05-06T05:04:18Z","receivedAt":"2010-05-06T05:04:18Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"git version 1.7.1, Mac OS X 10.6.3, largish repo (42K files, 35K\ncommits, well packed ~ 1GB). Difference between origin and HEAD is a\nsingle commit.\n\n$ time git diff --stat origin  >/dev/null\n\nreal\t0m0.942s\nuser\t0m0.713s\nsys\t0m0.223s\n\n$ time git diff --stat origin  >/dev/null\n\nreal\t0m0.944s\nuser\t0m0.712s\nsys\t0m0.227s\n\n$ time git diff --stat origin  >/dev/null\n\nreal\t0m0.944s\nuser\t0m0.712s\nsys\t0m0.225s\n\n$ time git diff --stat origin HEAD >/dev/null\n\nreal\t0m0.022s\nuser\t0m0.006s\nsys\t0m0.012s\n\n$ time git diff --stat origin HEAD >/dev/null\n\nreal\t0m0.022s\nuser\t0m0.006s\nsys\t0m0.013s\n\n$ time git diff --stat origin HEAD >/dev/null\n\nreal\t0m0.023s\nuser\t0m0.006s\nsys\t0m0.013s\n\nThese should be identical commands, so why is the \"origin HEAD\" form\nrunning an order of magnitude faster?\n\nj.\n"},{"id":"141027","messageId":"u2x76718491005052207z252008c5sb0d3eafb4a50ada6@mail.gmail.com","threadId":"23713","inReplyTo":"y2j76718491005052204qb6de9c26k58eb1550f1c5346f@mail.gmail.com","subject":"Re: git diff timing oddity","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-05-06T05:07:59Z","receivedAt":"2010-05-06T05:07:59Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Thu, May 6, 2010 at 1:04 AM, Jay Soffian <jaysoffian@gmail.com> wrote:\n> These should be identical commands, so why is the \"origin HEAD\" form\n> running an order of magnitude faster?\n\nBecause I'm an idiot. Three times I ran \"origin\" and thought I was\nrunning \"origin..\". Sigh.\n\nj.\n"},{"id":"141028","messageId":"20100506050836.GA11578@coredump.intra.peff.net","threadId":"23713","inReplyTo":"y2j76718491005052204qb6de9c26k58eb1550f1c5346f@mail.gmail.com","subject":"Re: git diff timing oddity","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-05-06T05:08:36Z","receivedAt":"2010-05-06T05:08:36Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, May 06, 2010 at 01:04:18AM -0400, Jay Soffian wrote:\n\n> git version 1.7.1, Mac OS X 10.6.3, largish repo (42K files, 35K\n> commits, well packed ~ 1GB). Difference between origin and HEAD is a\n> single commit.\n> \n> $ time git diff --stat origin  >/dev/null\n> \n> real\t0m0.942s\n> user\t0m0.713s\n> sys\t0m0.223s\n>\n> [...]\n>\n> $ time git diff --stat origin HEAD >/dev/null\n> \n> real\t0m0.022s\n> user\t0m0.006s\n> sys\t0m0.012s\n>\n> [...]\n> \n> These should be identical commands, so why is the \"origin HEAD\" form\n> running an order of magnitude faster?\n\nIsn't \"git diff --stat origin\" comparing against the working tree?\n\n-Peff\n"}]}