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

Re: git blame vs git log --follow performance

From
Duy Nguyen <pclouds@gmail.com>
Date
Jan 27, 2014, 02:34 UTC
Message-ID
<CACsJy8A2zpOejtaCd8y8vAJW1LV6to0WRD+es7g-7o2hEUiBxA@mail.gmail.com>
In-Reply-To
<1390770652.20150.25.camel@joe-AO722>
On Mon, Jan 27, 2014 at 4:10 AM, Joe Perches <joe@perches.com> wrote:
> Is there something that can be done about improving
> git log --follow -- <file> performance to be nearly
> equivalent speed to git blame -- <file> ?

Not strictly about --follow, but there is room for improvement for diff'ing in log in general. Right now we do "diff HEAD HEAD~1", "diff HEAD~1 HEAD~2" and so on (--follow needs diff to detect rename). At each step we load new tree objects and reparse. Notice after "diff HEAD HEAD~1" we may have "HEAD~1" and its subtrees read and parsed (not entirely). We could reuse that "diff HEAD~1 HEAD~2".

On git.git, "git log --raw" takes 10s and it seems tree object reading is about 2s.In ideal case we might be able to cut that to 1s. The tree parsing code (update_tree_entry) takes about 5s. We might be able to cut that in half, I'm not entirely sure. But there could be a lot of work in caching "HEAD~1" and the overhead may turn out too high for any gain.

-- 
Duy
Previous: Joe Perches
Message 4 of 4 in “git blame vs git log --follow performance”
  1. Joe PerchesJan 26, 2014
  2. Duy NguyenJan 27, 2014
  3. Joe PerchesJan 27, 2014
  4. Duy NguyenJan 27, 2014

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.